![]() | ![]() | ||||||||
| | #1 |
| Warrior Member Join Date: Feb 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
| 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; }); }); }); |
| | |
| | #2 | |
| Advanced Warrior War Room Member Join Date: May 2004 Location: Perth, Australia.
Posts: 741
Thanks: 5
Thanked 192 Times in 144 Posts
|
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 Quote:
| |
| -------------------------------------------------- Any man who reads too much and uses his own brain too little falls into lazy habits of thinking - Albert Einstein | ||
| | |
| | #3 |
| ResponsiveDesignTest.Net Registered Member Join Date: Nov 2011 Location: Spain
Posts: 635
Thanks: 64
Thanked 165 Times in 148 Posts
|
Give me the URL please.
|
|
HTML/CSS/jQuery/ZURB Foundation 3/Twitter Bootstrap 2/Wordpress/Frontend Performance Optimizing --- Need HTML/CSS help? Skype: microcosmic - Test Your Responsive Design - InternetCookies.eu | |
| | |
![]() |
|
| Bookmarks |
| Tags |
| fix, null, property, read, top, typeerror, uncaught |
| Thread Tools | |
| |
![]() |