Overswipe

优质
小牛编辑
133浏览
2023-12-01

描述 (Description)

滑动太多时会自动触发过overswipe 。 以下列表描述了overswipe其他几点。

  • 可以使用swipeout-overswipe类将swipeout-overswipe应用于操作按钮。

  • 它只能在右侧滑动的最后一个按钮上使用,并且只能在左侧滑动操作中的第一个按钮上使用。

  • 您需要向overswipe按钮添加适当的事件侦听器。

  • 在过度擦拭期间, swipeout-overswipe-active类将添加到overswipe按钮,可用于额外的样式。

例子 (Example)

以下示例显示了在Framework7中使用过度擦除的滑动操作太多时的项目 -

<!DOCTYPE html>
<html>
   <head>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1, 
         maximum-scale = 1, minimum-scale = 1, user-scalable = no, minimal-ui" />
      <meta name = "apple-mobile-web-app-capable" content = "yes" />
      <meta name = "apple-mobile-web-app-status-bar-style" content = "black" />
      <title>Overswipe</title>
      <link rel = "stylesheet" 
         href = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/css/framework7.ios.min.css" />
      <link rel = "stylesheet" 
         href = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/css/framework7.ios.colors.min.css" />
   </head>
   <body>
      <div class = "views">
         <div class = "view view-main">
            <div class = "pages">
               <div data-page = "home" class = "page navbar-fixed">
                  <div class = "navbar">
                     <div class = "navbar-inner">
                        <div class = "left"> </div>
                        <div class = "center">Swipe To Delete</div>
                        <div class = "right"> </div>
                     </div>
                  </div>
                  <div class = "page-content">
                     <div class = "list-block media-list">
                        <ul>
                           <li class = "swipeout">
                              <div class = "swipeout-content">
                                 <a href = "#" class = "item-content item-link">
                                    <div class = "item-inner">
                                       <div class = "item-title-row">
                                          <div class = "item-title">Amayon</div>
                                          <div class = "item-after">7:10</div>
                                       </div>
                                       <div class = "item-subtitle">Your order has been shipped</div>
                                       <div class = "item-text">Lorem ipsum dolor sit amet, consectetur 
                                          adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim 
                                          lacus tincidunt.</div>
                                    </div>
                                 </a>
                              </div>
                              <div class = "swipeout-actions-left"><a href = "#" class = "swipeout-overswipe bg-pink reply">Reply</a><a href = "#" class = "bg-blue forward">Forward</a></div>
                              <div class = "swipeout-actions-right"><a href = "#" class = "mark bg-lightblue">Spam</a><a href = "#" class = "swipeout-delete swipeout-overswipe">Delete</a></div>
                           </li>
                           <li class = "swipeout">
                              <div class = "swipeout-content">
                                 <a href = "#" class = "item-content item-link">
                                    <div class = "item-inner">
                                       <div class = "item-title-row">
                                          <div class = "item-title">VodafoneZone</div>
                                          <div class = "item-after">10:15</div>
                                       </div>
                                       <div class = "item-subtitle">Bill Payments</div>
                                       <div class = "item-text">Lorem ipsum dolor sit amet, consectetur 
                                          adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim
                                          lacus tincidunt.</div>
                                    </div>
                                 </a>
                              </div>
                              <div class = "swipeout-actions-left"><a href = "#" class = "swipeout-overswipe bg-pink reply">Reply</a><a href = "#" class = "bg-blue forward">Forward</a></div>
                              <div class = "swipeout-actions-right"><a href = "#" class = "mark bg-lightblue">Spam</a><a href = "#" class = "swipeout-delete swipeout-overswipe">Delete</a></div>
                           </li>
                           <li class = "swipeout">
                              <div class = "swipeout-content">
                                 <a href = "#" class = "item-content item-link">
                                    <div class = "item-inner">
                                       <div class = "item-title-row">
                                          <div class = "item-title">Popular in your network</div>
                                          <div class = "item-after">19:14</div>
                                       </div>
                                       <div class = "item-subtitle">New messages from John Doe</div>
                                       <div class = "item-text">Lorem ipsum dolor sit amet, consectetur 
                                          adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim
                                          lacus tincidunt.</div>
                                    </div>
                                 </a>
                              </div>
                              <div class = "swipeout-actions-left"><a href = "#" class = "swipeout-overswipe bg-pink reply">Reply</a><a href = "#" class = "bg-blue forward">Forward</a></div>
                              <div class = "swipeout-actions-right"><a href = "#" class = "mark bg-lightblue">Spam</a><a href = "#" class = "swipeout-delete swipeout-overswipe">Delete</a></div>
                           </li>
                           <li class = "swipeout">
                              <div class = "swipeout-content">
                                 <a href = "#" class = "item-content item-link">
                                    <div class = "item-inner">
                                       <div class = "item-title-row">
                                          <div class = "item-title">Adam WillSmith</div>
                                          <div class = "item-after">22:44</div>
                                       </div>
                                       <div class = "item-subtitle">Car Insurance renewal</div>
                                       <div class = "item-text">Lorem ipsum dolor sit amet, consectetur 
                                          adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim
                                          lacus tincidunt.</div>
                                    </div>
                                 </a>
                              </div>
                              <div class = "swipeout-actions-left"><a href = "#" class = "swipeout-overswipe bg-pink reply">Reply</a><a href = "#" class = "bg-blue forward">Forward</a></div>
                              <div class = "swipeout-actions-right"><a href = "#" class = "mark bg-lightblue">Spam</a><a href = "#" class = "swipeout-delete swipeout-overswipe">Delete</a></div>
                           </li>
                           <li class = "swipeout">
                              <div class = "swipeout-content">
                                 <a href = "#" class = "item-content item-link">
                                    <div class = "item-inner">
                                       <div class = "item-title-row">
                                          <div class = "item-title">Twitter</div>
                                          <div class = "item-after">23:22</div>
                                       </div>
                                       <div class = "item-subtitle">Follow Vivekananda Fans and Bill Gates</div>
                                       <div class = "item-text">Lorem ipsum dolor sit amet, consectetur 
                                          adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim 
                                          lacus tincidunt.</div>
                                    </div>
                                 </a>
                              </div>
                              <div class = "swipeout-actions-left"><a href = "#" class = "swipeout-overswipe bg-pink reply">Reply</a><a href = "#" class = "bg-blue forward">Forward</a></div>
                              <div class = "swipeout-actions-right"><a href = "#" class = "mark bg-lightblue">Spam</a><a href = "#" class = "swipeout-delete swipeout-overswipe">Delete</a></div>
                           </li>
                        </ul>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </div>
      <script type = "text/javascript" 
         src = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/js/framework7.min.js"></script>
      <script>
         var myApp = new Framework7();
         var $$ = Dom7;
         $$('.mark').on('click', function () {
            myApp.alert('Spam');
         });
         $$('.reply').on('click', function () {
            myApp.alert('Reply');
         });
         $$('.forward').on('click', function () {
            myApp.alert('Forward');
         });
      </script>
   </body>
</html>

输出 (Output)

让我们执行以下步骤,看看上面给出的代码是如何工作的 -

  • 将上面给出的HTML代码保存为服务器根文件夹中的list_views_swipe_basic.html文件。

  • 以http://localhost/list_views_swipe_basic.html打开此HTML文件,输出显示如下。

  • 当您滑动过多时,此示例会自动触发过冲动作,脚本将自动触发过冲按钮上的“单击”事件。