简体   繁体   English

带有缩略图分页的Jquery Cycle插件

[英]Jquery Cycle Plugin with Thumbnail Paging

I am trying to get the jQuery cycle plugin working in a CMS (hence the messy mark up) and have everything working except the paging thumbnails. 我正在尝试使jQuery cycle插件在CMS中工作(从而使标记混乱),并使除分页缩略图外的所有内容均正常工作。 Due to the CMS, I have to put the thumbnails' URLs in their corresponding image's class. 由于使用CMS,我必须将缩略图的URL放入其对应的图像类中。 Then I am trying to pull those URLs and use them for the paging buttons' images. 然后,我尝试提取这些URL并将其用于分页按钮的图像。 The paging wrapper is being built, but each paging button is empty. 正在构建分页包装器,但是每个分页按钮为空。 Not sure what I am doing wrong. 不知道我在做什么错。

I also have multiple cycle slideshows on the same page. 我在同一页面上也有多个循环幻灯片。

Here is my javascript: 这是我的JavaScript:

    (function ($) {
    $('.gallery').each(function (i) {
        $(this).after('<div class="galleryNav galleryNav' + i + '">').cycle({
            fx: 'scrollHorz',
            speed: 'fast',
            timeout: 0,
            pager: '.galleryNav' + i,
            pagerAnchorBuilder: function (idx, slide) {
            var slideImg = $(slide).attr('class');

            if (slideImg == undefined){
            slideImg = "";
            };
            return '<div><a href="#" style="background-image:url(' + slideImg + ');"></a></div>';
            }
        });
    });
})(jQuery);

and here is my HTML: 这是我的HTML:

<div class="row">
 <article class="galleryArticle">
      <div class="galleryWrap">
           <div class="gallery">
                <img src="image1.jpg" class="image1Thumb.jpg" alt="image1" />
                <img src="image2.jpg" class="image2Thumb.jpg" alt="image1" />
                <img src="image3.jpg" class="image3Thumb.jpg" alt="image1" />
                <img src="image4.jpg" class="image4Thumb.jpg" alt="image1" />
           </div>
      </div>
      <header>
           <h1 class="articleTitle">Title</h1>
           <h2 class="eventDate">Date</h2>
      </header>
      <div class="articleContent">Article Content</div>
 </article>

Thanks for the help. 谢谢您的帮助。

The class name you given to the img tag is invalid 您为img标签指定的类名无效

the class name should be start with a . 类名应以开头。 and followed by a name but you gave name as 然后跟一个名字,但是你给了名字

image1Thumb.jpg its invalid

just use like this 只是这样使用

in your stle sheet 在你的底纸上

 .image1Thump { your styles goes here }

in your html 在你的HTML

<img src="image1.jpg" class="image1Thumb" alt="image1" />

Then it should work. 然后它应该工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM