Jump to content

PROBLEM WITH jquery


yosii

Recommended Posts

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!!!

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.