This post has been overwritten by a script.
This post has been edited by averagehumanbeing: Jul 21 2017, 07:14 AM
------, ------
------, ------
|
|
Jan 23 2016, 07:42 PM, updated 9y ago
Show posts by this member only | Post
#1
|
![]() ![]()
Junior Member
51 posts Joined: Apr 2015 From: Utah, US of A |
This post has been overwritten by a script.
This post has been edited by averagehumanbeing: Jul 21 2017, 07:14 AM |
|
|
|
|
|
Jan 23 2016, 07:58 PM
Show posts by this member only | Post
#2
|
![]() ![]()
Junior Member
138 posts Joined: Jun 2008 |
You saying your code will works if the link shows "http://google.com/index.html#projects" ?
|
|
|
Jan 23 2016, 08:04 PM
Show posts by this member only | Post
#3
|
![]() ![]()
Junior Member
51 posts Joined: Apr 2015 From: Utah, US of A |
This post has been overwritten by a script.
This post has been edited by averagehumanbeing: Jul 21 2017, 07:14 AM |
|
|
Jan 23 2016, 08:08 PM
Show posts by this member only | Post
#4
|
![]() ![]()
Junior Member
138 posts Joined: Jun 2008 |
Probably you did not set the href on the anchor. Redirection using script will not show the hyperlink when you hover.
As what you trying to achieve. Your code is quite redundant because you loop over all the anchors whenever you scroll lol. You can append custom data to any tags and you can use jquery to retrieve the custom data. So you might want to use the custom data to the functions you need. Edit : right client on chrome and you can use the basic client script cheker. You should see the red line that is causing the error. Of course it's very simple troubleshooting feature unlike vbs. This post has been edited by ChaoGuGu: Jan 23 2016, 08:15 PM |
|
|
Jan 23 2016, 08:10 PM
Show posts by this member only | Post
#5
|
![]() ![]()
Junior Member
157 posts Joined: Sep 2010 |
href is empty?
u should use anchors that are not related to ur element id, then use location.hash value to find the element in ur document. example: index.php#home ur element's id should be id="page-home", then use javascript to find the element "page-"+location.hash and scroll to that element |
|
|
Jan 23 2016, 08:25 PM
Show posts by this member only | Post
#6
|
![]() ![]() ![]()
Junior Member
398 posts Joined: Dec 2013 |
|
|
|
Jan 23 2016, 08:28 PM
Show posts by this member only | IPv6 | Post
#7
|
![]() ![]() ![]() ![]() ![]() ![]()
Senior Member
1,072 posts Joined: Jan 2003 From: 8 5 0 0 0 |
Try this one?
CODE (function() { var delay = false; $(document).on('mousewheel DOMMouseScroll', function(event) { event.preventDefault(); if(delay) return; delay = true; setTimeout(function(){delay = false},200) var wd = event.originalEvent.wheelDelta || -event.originalEvent.detail; var a= document.getElementsByTagName('a'); if(wd < 0) { for(var i = 0; i < a.length; i++) { var t = a[i].getClientRects()[0].top; if(t >= 40) break; } } else { for(var i = a.length-1; i >= 0; i--) { var t = a[i].getClientRects()[0].top; if(t < -20) break; } } if (typeof a[i] != 'undefined') { $('html,body').animate({ scrollTop: a[i].offsetTop }); var href = $.attr(a[i], 'name'); window.location.hash = href; } else { history.pushState("", document.title, window.location.pathname + window.location.search); } }); })(); |
| Change to: | 0.0120sec
0.78
5 queries
GZIP Disabled
Time is now: 16th December 2025 - 02:25 PM |