Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 14th Feb 2013, 01:04 AM   #1
Warrior Member
 
Join Date: 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default
how to fix uncaught typeError: cannot read property 'top' of null ?
Share on: 
fb share twitter share gplus share more share

HelloFriends i have a jquery problem. whenever i tried to apply on click scroll script i got this error "uncaught typeError: cannot read property 'top' of null". Here following is code of Jquery.How can this will be fixed.

$(document).ready(function($){
$('a[href^="#"]').bind('click.smoothscroll',function (e) {
e.preventDefault();

var target = this.hash,
$target = $(target);

$('html, body').stop().animate({
'scrollTop': $target.offset().top
}, 900, 'swing', function () {
window.location.hash = target;
});
});

});
Marshall23 is offline  
Unread 14th Feb 2013, 02:18 AM   #2
Advanced Warrior
War Room Member
 
Bruce Hearder's Avatar
 
Join Date: 2004
Location: Perth, Australia.
Posts: 724
Thanks: 6
Thanked 184 Times in 136 Posts
Default
Re: how to fix uncaught typeError: cannot read property 'top' of null ?
Share on: 
fb share twitter share gplus share more share

I guess from this error, that $target is not defined.. Might need to do some console debugging and see what it comes back with.

Hope this helps

bruce

Originally Posted by Marshall23 View Post

HelloFriends i have a jquery problem. whenever i tried to apply on click scroll script i got this error "uncaught typeError: cannot read property 'top' of null". Here following is code of Jquery.How can this will be fixed.

$(document).ready(function($){
$('a[href^="#"]').bind('click.smoothscroll',function (e) {
e.preventDefault();

var target = this.hash,
= $(target);

$('html, body').stop().animate({
'scrollTop': .offset().top
}, 900, 'swing', function () {
window.location.hash = target;
});
});

});
Bruce Hearder is offline  
Unread 14th Feb 2013, 04:12 AM   #3
ResponsiveDesignTest.Net
Registered Member
 
Michael71's Avatar
 
Join Date: 2011
Location: Rostock, Germany
Posts: 829
Thanks: 106
Thanked 225 Times in 194 Posts
Default
Re: how to fix uncaught typeError: cannot read property 'top' of null ?
Share on: 
fb share twitter share gplus share more share

Give me the URL please.

HTML/CSS/jQuery/ZURB Foundation/Twitter Bootstrap/Wordpress/Frontend Performance Optimizing
---
Need HTML/CSS help? Skype: microcosmic - Test Your Responsive Design - InternetCookies.eu
Michael71 is offline  
Closed Thread


Bookmarks

Tags
fix, null, property, read, top, typeerror, uncaught


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 12:38 PM.