Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jan 2010
    Posts
    160
    Thanks
    10
    Thanked 1 Time in 1 Post

    Help to stop auto slide

    Hi

    I have the following code which is for jquery slider and cant even remember where it came from to even look at the support pages.

    However is there a way to stop it auto sliding I want it to be a manual process.

    Code:
    $(document).ready(function() {
    //Activate First Link
    $(".contentnav a:first").addClass("active");
    //width of a single content area
    var contentwidth = $(".contentholder").width();
    //Total number of content
    var totalcontent = $(".content").size();
    //Total width of all content area
    var allcontentwidth = contentwidth * totalcontent;
    //contentslider to new size which we got in above step
    $(".contentslider").css({'width' : allcontentwidth});
    //Now right a new function for slide and slide navigation
    rotate = function(){
    //Number of times we need to slide
    var slideid = $active.attr("rel") - 1;
    //Set the distance which single content needs to slide
    var slidedistance = slideid * contentwidth;
    //Remove active class
    $(".contentnav a").removeClass('active');
    //Add Active Class
    $active.addClass('active');
    //Slider Animation
    $(".contentslider").animate({
            left: -slidedistance
        }, 500 );
    }; 
     
    //Set Time for Rotation of slide
    rotation = function(){
    play = setInterval(function(){
    //Next slide nav
    $active = $('.contentnav a.active').next();
    if ( $active.length === 0) {
    //Move to first slide nav
    $active = $('.contentnav a:first');
    }
    rotate();
    //Timer speed 5 sec
    }, 5000);
    };
    //Run rotation fuction
    rotation();
    $(".contentnav a").click(function() {
    $active = $(this);
    clearInterval(play);
    rotate();
    rotation();
    return false;
    });
    });
    Thanks
    Roy

  • #2
    Regular Coder
    Join Date
    Apr 2012
    Posts
    165
    Thanks
    1
    Thanked 39 Times in 39 Posts
    Could you clarify your question just a bit? Do you mean you simply want the slideshow to play once and then stop (i.e., no loop)? Or you want it to stop on each slide and then proceed only if the user clicks "Next"? Or did you want full user controls such as Start, Stop, Pause and Play buttons to control the slideshow? Or something else?

    I'll be happy to try to assist you once I know your end goal. Also, if you can provide a link to the page where this is being used, that is often helpful as well so I can see your work in action and then test new functions to produce your desired results.

  • #3
    Regular Coder
    Join Date
    Jan 2010
    Posts
    160
    Thanks
    10
    Thanked 1 Time in 1 Post
    Hi

    I want it to use the pagination part only to advance to the next slide.

    Reason being there is an issue with Chrome and this scripts when left in a browser tap. It forgets the speed restriction and runs at 100mph.

    So would rather stop it from sliding at all unless people click the pagination button 1,2,3 etc.

    Many thanks in advance for your help.

    Roy


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •