willikm
01-25-2011, 08:41 AM
I'm having trouble having two individual jQuery localscroll's work on the same page. I've searched hours on end for similar problems (including Ariel Flesler's docs/guide), but to no avail. This was actually my first day messing with jQuery, so I'm a bit inexperienced.
I currently have 1 localscroll exactly how I want it (the 'Design' box) but I'm having problems trying to get the 2nd localscroll (the 'Web Development' box) to work separately from the other one.
Here's the code I am using for the properly working localscroll:
$(document).ready(function(){
// Scroll initially if there's a hash (#something) in the url
$.localScroll.hash({
target: '#DesignView', // Could be a selector or a jQuery object too.
queue: true,
duration: 1500
});
$.localScroll({
target: '#DesignView', // could be a selector or a jQuery object too.
queue: true,
axis: 'x',
duration: 1000,
hash: false,
onBefore: function( e, anchor, $target ){
// The 'this' is the settings object, can be modified
},
onAfter: function( anchor, settings ){
// The 'this' contains the scrolled element (#content)
}
});
});
I want the #DesignNav hyperlinks to work with the #DesignView, and the #WebNav hyperlinks to work with the #WebView
What code do I need to add/modify for the 2nd box to work? I have a feeling it has to do with the fact that I'm not using something like: $('#WebNav').localScroll();
which I have tried, but I do not think I'm using it properly.
I'll be grateful to anywho that helps! Thanks!
I currently have 1 localscroll exactly how I want it (the 'Design' box) but I'm having problems trying to get the 2nd localscroll (the 'Web Development' box) to work separately from the other one.
Here's the code I am using for the properly working localscroll:
$(document).ready(function(){
// Scroll initially if there's a hash (#something) in the url
$.localScroll.hash({
target: '#DesignView', // Could be a selector or a jQuery object too.
queue: true,
duration: 1500
});
$.localScroll({
target: '#DesignView', // could be a selector or a jQuery object too.
queue: true,
axis: 'x',
duration: 1000,
hash: false,
onBefore: function( e, anchor, $target ){
// The 'this' is the settings object, can be modified
},
onAfter: function( anchor, settings ){
// The 'this' contains the scrolled element (#content)
}
});
});
I want the #DesignNav hyperlinks to work with the #DesignView, and the #WebNav hyperlinks to work with the #WebView
What code do I need to add/modify for the 2nd box to work? I have a feeling it has to do with the fact that I'm not using something like: $('#WebNav').localScroll();
which I have tried, but I do not think I'm using it properly.
I'll be grateful to anywho that helps! Thanks!