Reputation: 74
I need if user scrolled to <a id="stass">
this script runs
<script>
if(current id is stass){
var stassik = 1231;
}
</script>
if(current id is stass)
it s where I need to get info about current anchor. I mean, if user scrolled to this anchor, the var stassik
will become 1231
Upvotes: 0
Views: 59
Reputation: 1019
Try using IntersectionObserver API to achieve this. For more details: https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
Upvotes: 1