PDA

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



lucioperca
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

LucioPerca

ddadmin
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?

lucioperca
01-10-2013, 01:44 PM
Hi,

yes, that would be really desirable.

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

Thank you very much

lucioperca

ddadmin
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:


<script>

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(){
$targets.eq(cur).trigger('click.goto')
cur = (cur < $targets.length - 1)? cur+=1 : 0
}, 3000)
$(document).on('click', function(){
clearInterval( ddspytimer1 )
})



</script>

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

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

This solution works perfectly!