简体   繁体   中英

jQuery cycle plugin

So i found a little bug that seems to be valid, but i cant figure out how to correct it.

It seems as though the jQuery cycle is counting the h2 and the p tags as child elements of .slideshow, and creating a link in the mininav that is generated... so instead of just 2 child elements .slide, it is displaying 4?? both in firefox and chrome... IE displays just the 2.

So is there a way to modify the script to only count the first child element of .slideshow?

    <script type="text/javascript"> 
    $(function() {
        $('.slideshow')
        .before('<div id="mininav" class="mininav" />')
        .cycle({

            fx      : 'fade',
            speed   : 'fast',
            timeout : 5500,
            pause   : 1,
            pager   : '#mininav',
            before  : function() { if (window.console) console.log(this.src); }

        });


    });
    </script>

    <div class="slideshow">             

            <div class="slide" style="background:#fff url({iw_value name='slideshow.image'/}) no-repeat top left;">

                        <h2>{iw_value name='slideshow.headline'/}</h2>
                        <p>{iw_value name='slideshow.text'/}</p>            

            </div>

<div class="slide" style="background:#fff url({iw_value name='slideshow.image'/}) no-repeat top left;">

                        <h2>{iw_value name='slideshow.headline'/}</h2>
                        <p>{iw_value name='slideshow.text'/}</p>            

            </div>

            </div><!--/slideshow--> 

Have you tried the 'slideExpr' option in cycle? This allows you to select which child elements should be treated as slides.

Also, I recommend that you double check that the page validates just to make sure that something isn't off with the structure of .slide divs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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