Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-04-2012, 02:25 PM   PM User | #1
ROYW1000
Regular Coder

 
Join Date: Jan 2010
Posts: 151
Thanks: 10
Thanked 1 Time in 1 Post
ROYW1000 is an unknown quantity at this point
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
ROYW1000 is offline   Reply With Quote
Old 05-04-2012, 02:43 PM   PM User | #2
EpicWebDesign
Regular Coder

 
Join Date: Apr 2012
Posts: 165
Thanks: 1
Thanked 39 Times in 39 Posts
EpicWebDesign will become famous soon enough
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.
EpicWebDesign is offline   Reply With Quote
Old 05-04-2012, 03:05 PM   PM User | #3
ROYW1000
Regular Coder

 
Join Date: Jan 2010
Posts: 151
Thanks: 10
Thanked 1 Time in 1 Post
ROYW1000 is an unknown quantity at this point
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
ROYW1000 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:07 PM.


Advertisement
Log in to turn off these ads.