超美しいjQuery画像カルーセルeffect_jquery

WBOY
リリース: 2016-05-16 15:30:09
オリジナル
1108 人が閲覧しました

優れた jQuery プラグインである jCarousel プラグインを使用した、非常に美しい jQuery 画像カルーセル効果。サムネイルによる左右の切り替えをサポートし、Ajax 読み込みデータをサポートし、応答性の高いレイアウトをサポートし、モバイル タッチ スクリーンをサポートし、強力な API パラメータ構成をサポートします。関数と関数コールバック関数、カスタム アニメーション速度とアニメーション モードのサポート、カルーセル方向の定義のサポート、それでも非常に優れており、学習して使用することをお勧めします。

使用方法:
1. jQuery とプラグインをロードします

<link rel="stylesheet" type="text/css" href="jcarousel.basic.css">
<script type="text/javascript" src="libs/jquery/jquery.js"></script>
<script type="text/javascript" src="dist/jquery.jcarousel.min.js"></script>
ログイン後にコピー

2.HTML コンテンツ

<div class="jcarousel-wrapper">
<div class="jcarousel">
 <ul>
 <li><img src="../_shared/img/img1.jpg" width="600" height="400" alt=""></li>
 <li><img src="../_shared/img/img2.jpg" width="600" height="400" alt=""></li>
 <li><img src="../_shared/img/img3.jpg" width="600" height="400" alt=""></li>
 <li><img src="../_shared/img/img4.jpg" width="600" height="400" alt=""></li>
 <li><img src="../_shared/img/img5.jpg" width="600" height="400" alt=""></li>
 <li><img src="../_shared/img/img6.jpg" width="600" height="400" alt=""></li>
 </ul>
</div>
<a href="#" class="jcarousel-control-prev">&lsaquo;</a>
<a href="#" class="jcarousel-control-next">&rsaquo;</a>
<p class="jcarousel-pagination">
</p>
</div>
ログイン後にコピー

3. 関数呼び出し

 <script type="text/javascript">
 $(function(){
   $('.jcarousel').jcarousel(); 
     $('.jcarousel-control-prev')
       .on('jcarouselcontrol:active', function() {
         $(this).removeClass('inactive');

       })
       .on('jcarouselcontrol:inactive', function() {
         $(this).addClass('inactive');

       })
       .jcarouselControl({
         target: '-=1'
       });
     $('.jcarousel-control-next')
       .on('jcarouselcontrol:active', function() {

         $(this).removeClass('inactive');

       })
       .on('jcarouselcontrol:inactive', function() {
         $(this).addClass('inactive');
       })
       .jcarouselControl({
         target: '+=1'
      });
 
     $('.jcarousel-pagination')
        .on('jcarouselpagination:active', 'a', function() {
        $(this).addClass('active');
       })
       .on('jcarouselpagination:inactive', 'a', function() {
         $(this).removeClass('active');
      })
       .jcarouselPagination();
   });
 });
ログイン後にコピー

上記は、すべての人に推奨される jQuery 画像カルーセル効果のキー コードです。これをさらに改良する必要があります。これを以前の記事と組み合わせて学習すると、間違いなく予期せぬメリットが得られます。

ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!