jquery - Toggle event hides my div for no reason -
hi have checkbox want toggle. when click/check first time, starts setinterval (starts slideshow) , when click sec time, stops slideshow (clearinterval). no reason, hides/display:none checkbox when page loads...
$("#start").toggle(function () { var interval = setinterval(function() { alert("hey") img++ if (img == 27) { img = 0; } $("[src='images/slideshow2/carre/slideimg" + img + ".jpg']").fadein() $("#imgronde").attr("src", "images/slideshow2/carre/slideimg" + img + ".jpg"); $(".grandeurori").attr("href", "images/slideshow2/slideimg" + img + ".jpg"); }, 3000); }, function () { clearinterval(interval) })
hopefuly, can help me.
.toggle()
not way trigger event on checkbox. function hide/show. want utilize .change()
http://api.jquery.com/toggle/
http://api.jquery.com/change/
jquery setinterval
No comments:
Post a Comment