You will recieve your password to this address. Address is not made public.

Your preferred username that is used when logging in.

Pausing Automatic Scrolling Created Jun 4, 2009

This thread is solved

Views: 2594     Replies: 5     Last reply Jun 6, 2009  
You must login first before you can use this feature

kensoliva

Posts: 3

Registered:
Jun 4, 2009

Pausing Automatic Scrolling

Posted: Jun 4, 2009

Is it possible to programmatically pause automatic scrolling? I don't see any mention of this functionality in your documentation.

Thanks in advance for your help,
Ken

Tero
Author of jQuery Tools and this website + JavaScript developer of Flowplayer.

Posts: 1867

Registered:
Nov 16, 2007

» Pausing Automatic Scrolling

Posted: Jun 4, 2009

Reply to: Pausing Automatic Scrolling, from kensoliva
Hello,

You can update the interval parameter dynamically. For example this call


$("div.scrollable:first").scrollable().getConf().interval = 0

will pause this page

http://flowplayer.org/tools/demos/scrollable/autoscroll.html

After updating the interval to a value, say: 1000 and mouseovering the scrollable the autoscrolling begins again. Unfortunately the mouseover is needed at this point to resume scrolling.

kensoliva

Posts: 3

Registered:
Jun 4, 2009

» » Pausing Automatic Scrolling

Posted: Jun 5, 2009

Reply to: » Pausing Automatic Scrolling, from tipiirai
Thanks for the reply. If I understand correctly I cannot have a page load with automatic scrolling enabled, but disable it when the user clicks on the navigational elements for the same instance of scrollable. Is that accurate?

Tero
Author of jQuery Tools and this website + JavaScript developer of Flowplayer.

Posts: 1867

Registered:
Nov 16, 2007

» » » Pausing Automatic Scrolling

Posted: Jun 5, 2009

Reply to: » » Pausing Automatic Scrolling, from kensoliva
you can do this with jQuery. for example:


$("div.scrollable").click(function() {
  $(this).scrollable().getConf().interval = 0 
});

kensoliva

Posts: 3

Registered:
Jun 4, 2009

» » » » Pausing Automatic Scrolling

Posted: Jun 5, 2009

Reply to: » » » Pausing Automatic Scrolling, from tipiirai
I am having trouble making this work. Below is my code to initialize the instance of scrollable, which otherwise works flawlessly, and the code I thought would stop automatic scrolling when the user clicks on the navigational elements.


$(document).ready(function() {

	$("#marquee_wrapper .scrollable").scrollable({
		size: 1,
		vertical: true,
		loop: true,
		interval: 10000,
		speed: 200,
		clickable: false,
		navi: '.rotator'
	});
	
	$("#marquee_wrapper .rotator a").click(function() { 
		$(this).scrollable().getConf().interval = 0;
	});

});

I'd also like to call a method to pause the automatic scrolling from outside of my instance of scrollable. For example, I'm using scrollable to create a homepage marquee slideshow and I'd like scrolling to pause while the website's global navigational menu is open and z-indexed above the marquee. It is a bit distracting if the marquee is obscured, but still scrolling beneath the menu.

Thanks again for all of your help,
Ken

Tero
Author of jQuery Tools and this website + JavaScript developer of Flowplayer.

Posts: 1867

Registered:
Nov 16, 2007

» » » » » Pausing Automatic Scrolling

Posted: Jun 6, 2009

Reply to: » » » » Pausing Automatic Scrolling, from kensoliva
change your .rotator a click event to this:


$("#marquee_wrapper .rotator a").click(function() {  
   $(".scrollable").scrollable().getConf().interval = 0; 
}); 

works if you have one scrollable on the page. if you have many you should do


$(this).parents(".scrollable").scrollable().getConf().interval = 0; 

inside the click handler.