简体   繁体   中英

Jquery Cycle plugin. Command Prev not working

I'm having trouble getting the Jquery Cycle plugin to work. My code is below. Whats happening is the Next button is going through the slides sequentially, however when I press previous, it goes previous starting from the last image in the sequence. I dont want it to automaticly play which is why on my document.ready function I call the pause command.

Any help will be appreciated.

-Sam

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<!-- include Cycle plugin -->
<script type="text/javascript" src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.latest.js"></script>


<script type="text/javascript">
    $(document).ready(function() {

        $('.main').cycle({
            fx : 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        });

        $(".main").cycle("pause");

    });

</script>

 // extra page code not shown //


    <div class="main" id="main">
        <img src="../images/design/beautiful1.jpg" height=600 width=500>
        <img  src="../images/design/beautiful2.jpg" height=600 width=500>
        <img  src="../images/design/beautiful3.jpg" height=600 width=500>
        <img  src="../images/design/beautiful4.jpg" height=600 width=500>

    </div>


</body>

<div class="label" id="nextbutton"><img src="../images/nextarrow.jpg"></div>
<div class="label" id="prevbutton"><img src="../images/prevarrow.jpg"></div>

<script>

      $("#nextbutton").live("click",function(){

                $(".main").cycle("next");

        }


     );

       $("#prevbutton").live("click",function(){

                $(".main").cycle("prev");

        }


     );

</script>

似乎对我来说工作正常: http : //jsfiddle.net/petersendidit/4f2hx/

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