-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
detect if element to be acted on is actually on top/viewable
- Loading branch information
Ryan Ong
committed
Nov 9, 2023
1 parent
696b7ef
commit 478fcbf
Showing
3 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<style type="text/css"> | ||
body { | ||
width: 800px; | ||
margin: 0; | ||
} | ||
#hidden-link { | ||
position: relative; | ||
top: 740px; | ||
} | ||
#wrapper { | ||
height: 1200px; | ||
} | ||
#footer { | ||
position: fixed; | ||
left: 0; | ||
bottom: 0; | ||
width: 100%; | ||
background-color: red; | ||
color: white; | ||
text-align: center; | ||
height: 100px; | ||
} | ||
</style> | ||
<script type="text/javascript"> | ||
window.onload = function() { | ||
var log = document.querySelector("#log") | ||
var boxes = document.querySelectorAll("#hidden-link") | ||
for (var i = 0; i < boxes.length; i++) { | ||
var el = boxes[i] | ||
el.onclick = function() { | ||
log.textContent = this.id | ||
} | ||
} | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<div id="log"></div> | ||
<div id="wrapper"> | ||
<a id="hidden-link" href="#">hidden link</a> | ||
</div> | ||
<div id="footer"></div> | ||
</body> | ||
</html> |