View Full Version : DD ScrollSpy Menu | Automatic scrolling possible?

01-04-2013, 09:39 AM
1) DD ScrollSpy Menu

2) http://www.dynamicdrive.com/dynamicindex1/ddscrollspymenu.htm

3) Describe problem:

Hello Forum,

has anyone an idea how to realize an automatic scrollfunktion in jQuery?

This script ist wonderful!

Thanks a lot for feedback


01-08-2013, 03:17 AM
Hmm do you mean have the script automatically scroll to the various breaking points set by Spy Menu on its own every x seconds?

01-10-2013, 01:44 PM

yes, that would be really desirable.

Do you have a Idde how this problem could be solved?

Thank you very much


01-11-2013, 09:06 AM
Using the invocation code of demo #1 on the script page as illustration, the code in red that follows will automatically trigger the going to of the various sections referred to inside the spy menu every x seconds. Clicking anywhere on the page cancels this cycling:


jQuery(function($){ // on document load
$('#horizontalmenu').ddscrollSpy({ // initialize first demo
scrolltopoffset: -50

var $targets = $('#horizontalmenu').find('a[href^="#"]')
var cur = 0
var ddspytimer1 = setInterval(function(){
cur = (cur < $targets.length - 1)? cur+=1 : 0
}, 3000)
$(document).on('click', function(){
clearInterval( ddspytimer1 )


Change "#horizontalmenu" to the ID of your spy menu, and 3000 to the desired pause (in milliseconds).

01-17-2013, 09:31 AM
Thanks a lot.

This solution works perfectly!