yosii Posted August 1, 2010 Share Posted August 1, 2010 hi i use this plug-in http://jquery.malsup.com/cycle/ with this i can slide my picture like this way http://jquery.malsup.com/cycle/pause.html i want that after all the image was show the slid will be stop so i do autostop:1 and this work OK. now i have a problem if you look on my page that i create here if you will click on play the slide will start and after all the pictures are show this will stop this is ok but...the problem is , that i want that after the function stop(because all the image was show) if i click on play the slide will work again... now after the function was stop(after one loop) if i click play this don't play this..... please help me thank you!!! Quote Link to comment https://forums.phpfreaks.com/topic/209535-problem-with-jquery/ Share on other sites More sharing options...
JasonLewis Posted August 2, 2010 Share Posted August 2, 2010 Where is your page? Quote Link to comment https://forums.phpfreaks.com/topic/209535-problem-with-jquery/#findComment-1094000 Share on other sites More sharing options...
yosii Posted August 2, 2010 Author Share Posted August 2, 2010 here http://alturl.com/3rupa sorry Quote Link to comment https://forums.phpfreaks.com/topic/209535-problem-with-jquery/#findComment-1094027 Share on other sites More sharing options...
yosii Posted August 2, 2010 Author Share Posted August 2, 2010 if you can edit my topic and write the url is http://alturl.com/3rupa i will be happy please help Quote Link to comment https://forums.phpfreaks.com/topic/209535-problem-with-jquery/#findComment-1094060 Share on other sites More sharing options...
KevinM1 Posted August 2, 2010 Share Posted August 2, 2010 You have a JavaScript error. The function restart() is not defined. Could be causing your problem. Quote Link to comment https://forums.phpfreaks.com/topic/209535-problem-with-jquery/#findComment-1094068 Share on other sites More sharing options...
yosii Posted August 2, 2010 Author Share Posted August 2, 2010 no it is not the problem (i deledt it) where do you see restart(); this where i can write function that will be start when the slide will be finished Quote Link to comment https://forums.phpfreaks.com/topic/209535-problem-with-jquery/#findComment-1094075 Share on other sites More sharing options...
KevinM1 Posted August 2, 2010 Share Posted August 2, 2010 Okay, well, the obvious answer then is that you don't have a way to restart your loop. Your play button only resumes the loop if it's paused. You'd probably be best served reading the Cycle plugin's documentation. EDIT: looking at the documentation myself, it seems that your autostop property is the culprit: http://jquery.malsup.com/cycle/options.html Take it out if you want an infinite loop. Quote Link to comment https://forums.phpfreaks.com/topic/209535-problem-with-jquery/#findComment-1094082 Share on other sites More sharing options...
yosii Posted August 2, 2010 Author Share Posted August 2, 2010 i read the documentation but i didnt find answer i find way to... when the loop is over i wrote in JS function that refresh the page but this is not comfortable for the user so i looking for another way to restart the function Quote Link to comment https://forums.phpfreaks.com/topic/209535-problem-with-jquery/#findComment-1094085 Share on other sites More sharing options...
KevinM1 Posted August 2, 2010 Share Posted August 2, 2010 i read the documentation but i didnt find answer i find way to... when the loop is over i wrote in JS function that refresh the page but this is not comfortable for the user so i looking for another way to restart the function Again, remove your autostop property. Autostop means "Stop the loop after X cycles." You have an autostop value of one, which means the loop will end after one cycle. Quote Link to comment https://forums.phpfreaks.com/topic/209535-problem-with-jquery/#findComment-1094087 Share on other sites More sharing options...
yosii Posted August 2, 2010 Author Share Posted August 2, 2010 no i want that after one loop the loop will be stop! but i want that if user want to show the slide again he will click on play and show it again Quote Link to comment https://forums.phpfreaks.com/topic/209535-problem-with-jquery/#findComment-1094091 Share on other sites More sharing options...
KevinM1 Posted August 2, 2010 Share Posted August 2, 2010 You still need to remove autostop. Autostop locks the number of cycles you can loop through. If you set it to 1, that's all you'll get to show. See if you can use the after callback to pause the loop after the last image has been shown. This should let the play button act the way you want it to act. Quote Link to comment https://forums.phpfreaks.com/topic/209535-problem-with-jquery/#findComment-1094127 Share on other sites More sharing options...
yosii Posted August 2, 2010 Author Share Posted August 2, 2010 You still need to remove autostop. Autostop locks the number of cycles you can loop through. If you set it to 1, that's all you'll get to show. See if you can use the after callback to pause the loop after the last image has been shown. This should let the play button act the way you want it to act. ok i drop autostop but idont know how to stop after i show the last picture Quote Link to comment https://forums.phpfreaks.com/topic/209535-problem-with-jquery/#findComment-1094173 Share on other sites More sharing options...
KevinM1 Posted August 2, 2010 Share Posted August 2, 2010 You still need to remove autostop. Autostop locks the number of cycles you can loop through. If you set it to 1, that's all you'll get to show. See if you can use the after callback to pause the loop after the last image has been shown. This should let the play button act the way you want it to act. ok i drop autostop but idont know how to stop after i show the last picture Like I said, look at the 'after' callback function and try putting in a pause command after your last image is shown. The website has a bunch of tutorials on it, one specifically showing how the 'after' callback works. Quote Link to comment https://forums.phpfreaks.com/topic/209535-problem-with-jquery/#findComment-1094182 Share on other sites More sharing options...
yosii Posted August 2, 2010 Author Share Posted August 2, 2010 You still need to remove autostop. Autostop locks the number of cycles you can loop through. If you set it to 1, that's all you'll get to show. See if you can use the after callback to pause the loop after the last image has been shown. This should let the play button act the way you want it to act. ok i drop autostop but idont know how to stop after i show the last picture Like I said, look at the 'after' callback function and try putting in a pause command after your last image is shown. The website has a bunch of tutorials on it, one specifically showing how the 'after' callback works. yes it is way like http://jquery.malsup.com/cycle/end.html but without autostop: 1 it is not work so i don't find a way please help me i tried this over 1 week Quote Link to comment https://forums.phpfreaks.com/topic/209535-problem-with-jquery/#findComment-1094185 Share on other sites More sharing options...
KevinM1 Posted August 2, 2010 Share Posted August 2, 2010 Try: $(function () { $('#pause').click(function() { $('#slides').cycle('pause'); return false; }); $('#play').click(function() { $('#slides').cycle('resume'); return false; }); $('#slideshow').hover( function() { $('#controls').fadeIn(); }, function() { $('#controls').fadeOut(); } ); $('#slides').cycle({ fx: 'all', speed: 400, timeout: 1000, next: '#next', prev: '#prev', after: onAfter }); }); function onAfter(curr, next, opts) { var index = opts.currentSlide; if (index === (opts.slideCount - 1)) { $('#slides').cycle('pause'); } } Code not tested, but I was suggesting something along those lines. Quote Link to comment https://forums.phpfreaks.com/topic/209535-problem-with-jquery/#findComment-1094204 Share on other sites More sharing options...
yosii Posted August 2, 2010 Author Share Posted August 2, 2010 Try: $(function () { $('#pause').click(function() { $('#slides').cycle('pause'); return false; }); $('#play').click(function() { $('#slides').cycle('resume'); return false; }); $('#slideshow').hover( function() { $('#controls').fadeIn(); }, function() { $('#controls').fadeOut(); } ); $('#slides').cycle({ fx: 'all', speed: 400, timeout: 1000, next: '#next', prev: '#prev', after: onAfter }); }); function onAfter(curr, next, opts) { var index = opts.currentSlide; if (index === (opts.slideCount - 1)) { $('#slides').cycle('pause'); } } Code not tested, but I was suggesting something along those lines. i thank you about your help so much but look' the loop not stop in the end http://bit.ly/dwri9A Quote Link to comment https://forums.phpfreaks.com/topic/209535-problem-with-jquery/#findComment-1094238 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.