温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

JavaScript怎么实现移动端手势滑动的幻灯片切换效果

发布时间:2022-03-16 17:27:20 来源:亿速云 阅读:192 作者:iii 栏目:web开发

这篇文章主要介绍了JavaScript怎么实现移动端手势滑动的幻灯片切换效果的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇JavaScript怎么实现移动端手势滑动的幻灯片切换效果文章都会有所收获,下面我们一起来看看吧。

代码如下:

<!DOCTYPE html>

<html lang="zh">

<head>

         <meta charset="UTF-8">

         <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

         <meta name="viewport" content="width=device-width, initial-scale=1.0">

         <title>支持移动端手势滑动的幻灯片切换制作</title>

         <meta name="keywords" content="支持移动端手势滑动的幻灯片切换制作" />

         <meta name="description" content="支持移动端手势滑动的幻灯片切换制作" />

         <link rel="stylesheet" type="text/css" href="css/normalize.css" />

         <link rel="stylesheet" type="text/css" href="css/htmleaf-demo.css">

         <link rel="stylesheet" type="text/css" href="css/style.css">

         <link rel="stylesheet" type="text/css" href="dist/swipeslider.css">

        

</head>

<body>

         <div class="htmleaf-container">

                   <header class="htmleaf-header">

                            <h2> 支持移动端手势滑动的幻灯片切换</h2>

                  

                   </header>

                   <article class="container">

                       <section>

                        

                         <figure id="full_feature" class="swipslider">

                           <ul class="sw-slides">

                            <li class="sw-slide">

                               <img src="img/summer_beach.jpg" alt="Summer beach concept">

                             </li>

                             <li class="sw-slide">

                               <img src="img/lang_yie_ar_kung_fu.jpg" alt="Lang from Yie Ar Kung Fu">

                             </li>      

                             <li class="sw-slide">

                               <img src="img/wanted1.jpg" alt="Example of a not sized slide">

                             </li>

                             <li class="sw-slide">

                               <img src="img/tiny_vacation.jpg" alt="Tiny Tina">

                             </li>

                             <li class="sw-slide">

                               <img src="img/borderlands_tiny_tina.jpg" alt="Tiny Tina from Borderlands 2">

                             </li>

                             <li class="sw-slide">

                               <img src="img/redhead.jpg" alt="Redhead girl">

                             </li>

                           </ul>

                         </figure>

                        

                       </section>

                       <section>

                         <h3>Content slider</h3>

                         <p>Image slider can work as content slider.</p>

                         <figure id="content_slider" class="swipslider">

                           <ul class="sw-slides">

                             <li class="sw-slide">

                               <figure class="wanted sw-content">

                                 <img src="img/wanted1.jpg" alt="Mafia Boss">

                                 <div class="description">

                                   <h2>Wanted: Mafia Boss</h2>

                                   <p>

                                     <strong>Description:</strong> accused in organization of criminal association that terrorise peaceful citizens of the Foo town.

                                   </p>

 

                                   <p>

                                     <strong>Distinguishing marks:</strong>

                                     </p>

                                     <ul>

                                       <li>smokes big cigars;</li>

                                       <li>wears a luxurious suit (even while sleeping);</li>

                                       <li>rose buttonhole.</li>

                                     </ul>

                                   <p class="award">

                                     <strong>Award:</strong> 200 000$ for reliable location information.

                                   </p>

                                 </div>

                               </figure>

                             </li>

                             <li class="sw-slide">

                               <figure class="wanted sw-content">

                                 <img src="img/wanted2.jpg" alt="Mafia Boss">

                                 <div class="description">

                                   <h2>Wanted: Underboss</h2>

                                   <p>

                                     <strong>Description:</strong> accused in being extremely rude with the members of his gang, shooting on public and

                                     uncontrolled behaviour under the influence.

                                   </p>

 

                                   <p>

                                     <strong>Distinguishing marks:</strong>

                                     </p>

                                     <ul>

                                       <li>always smooth;</li>

                                       <li>carrying a gun;</li>

                                       <li>drinking too much Scotch.</li>

                                     </ul>

                                   <p class="award">

                                     <strong>Award:</strong> 1000$ for more information on this subject.

                                   </p>

                                 </div>

                               </figure>

                             </li>

                             <li class="sw-slide">

                               <figure class="wanted sw-content">

                                 <img src="img/wanted3.jpg" alt="Mafia Boss">

                                 <div class="description">

                                   <h2>Wanted: Big guy nickname 'Peewee'</h2>

                                   <p>

                                     <strong>Description:</strong> accused in littering, bad language.

                                   </p>

 

                                   <p>

                                     <strong>Distinguishing marks:</strong>

                                   </p>

                                   <ul>

                                     <li>extremely big;</li>

                                     <li>little vocabulary;</li>

                                     <li>bald.</li>

                                   </ul>

                                   <p class="award">

                                     <strong>Award:</strong> 700$ for teaching him some good manners.

                                   </p>

                                 </div>

                               </figure>

                             </li>

                             <li class="sw-slide">

                               <figure class="wanted sw-content">

                                 <img src="img/wanted4.jpg" alt="Mafia Boss">

                                 <div class="description">

                                   <h2>Wanted: Cold blooded dude</h2>

                                   <p>

                                     <strong>Description:</strong> kills the audience with bad puns and pronounced eyebrows. 

                                   </p>

 

                                   <p>

                                     <strong>Distinguishing marks:</strong>

                                     </p>

                                     <ul>

                                       <li>carrying a blunt, plastic knife;</li>

                                       <li>wears napkin in right pocket;</li>

                                       <li>bold as a kneecap.</li>

                                     </ul>

                                   <p class="award">

                                     <strong>Award:</strong> 150 000$ for comedian courses for that person.

                                   </p>

                                 </div>

                               </figure>

                             </li>

                           </ul>

                         </figure>

                       </section>

                       <section>

                         <h3>Responsiveness</h3>

                         <p>Slider can resize itself with the window accordingly. Also image self resizing to fit slider.</p>

                         <figure id="responsiveness" class="swipslider">

                           <ul class="sw-slides">

                             <li class="sw-slide">

                               <img src="img/children_game_concept01.jpg" alt="Concept for children game">

                             </li>

                             <li class="sw-slide">

                               <img src="img/children_game_concept02.jpg" alt="Another Concept for children game">

                             </li>

                           </ul>

                         </figure>

                       </section>

                       <section>

                         <h3>Customizable</h3>

                         <p>Elements of slider can be easily customized.</p>

                         <figure id="customizability" class="swipslider">

                        <ul class="sw-slides">

                           <li class="sw-slide" style="background-color: #53c780">

                             <span class="slide-number">1</span>

                           </li>

                           <li class="sw-slide" style="background-color: #53c7b5">

                             <span class="slide-number">2</span>

                           </li>

                           <li class="sw-slide" style="background-color: #53b1c7">

                             <span class="slide-number">3</span>

                           </li>

                           <li class="sw-slide" style="background-color: #538dc7">

                             <span class="slide-number">4</span>

                           </li>

                           <li class="sw-slide" style="background-color: #535cc7">

                             <span class="slide-number">5</span>

                           </li>

                         </ul>

                         </figure>

                       </section>

                     </article>

                  

         </div>

         <div style="width: 100%; height: auto; line-height: 25px; text-align: center;">

                            </div>

         <script src="http://www.5iweb.com.cn/statics/js/jquery.1.7.1.min.js" type="text/javascript"></script>

        

         <script type="text/javascript" src="dist/swipeslider.min.js"></script>

         <script type="text/javascript">

                   $(window).load(function() {

                         $('#full_feature').swipeslider();

                         $('#content_slider').swipeslider({

                           transitionDuration: 600,

                           autoPlayTimeout: 10000,

                           sliderHeight: '300px'

                         });

                         $('#responsiveness').swipeslider();

                         $('#customizability').swipeslider({

                           transitionDuration: 1500,

                           autoPlayTimeout: 4000,

                           timingFunction: 'cubic-bezier(0.38, 0.96, 0.7, 0.07)',

                           sliderHeight: '30%'});

                       });

         </script>

</body>

</html>

关于“JavaScript怎么实现移动端手势滑动的幻灯片切换效果”这篇文章的内容就介绍到这里,感谢各位的阅读!相信大家对“JavaScript怎么实现移动端手势滑动的幻灯片切换效果”知识都有一定的了解,大家如果还想学习更多知识,欢迎关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI