I’m using Ariel Flesler’s awesome plugins ScrollTo & LocalScroll on a project.
I’ve copied the code from one project (where it is working perfectly to another). It’s not working on the new project and after a bit of debug I discovered that it’s the jQuery version.
The older project is on 1.3.2 and the newer is on 1.4.4. Firebug’s script debug is reporting the following error:
Break on Error
target is undefined
Lines 2 and 3 of the following code are the reason for the error being thrown:
// Scrolling function by Ariel Flesler http://flesler.webs.com/jQuery.LocalScroll/
jQuery(function( $ ){
var target = $().get(0);
target.scrollLeft = target.scrollTop = 0;
var $last = $([]);
$('#main-contain').localScroll({
axis:'y',
queue:true,
duration:1000,
hash:true,
lazy:true,
offset: { left:0, top:-100 },
onBefore:function( e, anchor, $target ){
$last.removeClass('scrolling');
$last = $(this).addClass('scrolling');
},
onAfter:function( anchor ){
$last.removeClass('scrolling');
}
});
});
Any ideas why the change from jQuery 1.3.2 to jQuery 1.4.4?
This is an empty jQuery object.
for some reason,
.get(0);is OK in jQuery 1.3.2, but does not work in jQuery 1.4.4. The solution is: