Home › Forums › JavaScript › Total Page Scroll Control
- This topic is empty.
-
AuthorPosts
-
January 23, 2018 at 10:14 am #265915
Funkaholik
ParticipantDo you mean that they can slowdown the website if not limited?
January 23, 2018 at 10:26 am #265916Shikkediel
ParticipantPotentially it could, even though it’s unlikely because of this script alone. But accumulative with other code it’s certainly possible. Optimisation’s always better.
January 23, 2018 at 12:46 pm #265926Funkaholik
ParticipantKeep me guessing..)
What kind of optimization?January 23, 2018 at 12:55 pm #265927Shikkediel
ParticipantThrottling, in this case. :-p
January 23, 2018 at 1:33 pm #265929Funkaholik
ParticipantActually i was thinkin about erasing opacity fading animation out of your script
since we have some extra from our css animations to apply + throttling)But i still don’t understand what it does.
those fuctions can’t be firing constantly, aren’t they?
plus we can’t limit them because user going to scroll randomly so there should be no delay.January 23, 2018 at 1:44 pm #265930Shikkediel
ParticipantThe scroll event itself can fire up to 60 times a second when normally scrolling and likely even more when dragging the scrollbar. There will be no noticeable delay when throttling, it only brings down events to about 20 times a second. Any more is usually unnecessary.
April 6, 2019 at 12:50 am #286000Funkaholik
ParticipantHey, Edo .. hows it going?
Do you remember that pen you did?
Since you’re at the role of a magician here on this topic))
Can you add some lines so nav links would become active when user scroll to a certain section?
RIght now they become active only after you click a link.April 6, 2019 at 4:54 am #286005Shikkediel
ParticipantHey Funk, how are you. Been a while.
I actually made a demo similar to that recently, I’ll see if I can adapt it for this over the weekend…
April 6, 2019 at 5:26 am #286006Funkaholik
ParticipantGave my eyes some rest.
Was doing other stuff which finally brought me here again)April 7, 2019 at 11:44 am #286022Shikkediel
ParticipantThis is it I think:
By the way…
e.preventDefault()
prevents the click from instantly snapping to the section (the default behaviour with anchor links) so that it can be animated instead. Wheree
is the event itself – and its related data.April 7, 2019 at 10:33 pm #286025Shikkediel
ParticipantLooking back through the topic, I kinda did the same thing already…
April 8, 2019 at 1:06 am #286029Funkaholik
Participantyeah its just .. it has animation
and its conflicting with other animations in css when i try to reuse it
thats why i asked you to write script just for scrollApril 8, 2019 at 6:30 am #286033Shikkediel
ParticipantUsing JS’s native
getBoundingClientRect
is a nicer approach anyway.April 9, 2019 at 9:33 am #286116Funkaholik
Participanti’ve noticed that nav links become active as next window starts to appear in the bottom like here
is it possible to make a nav link become active in the middle or top of the screen if you know what i mean?April 9, 2019 at 8:44 pm #286179Shikkediel
ParticipantIt’s all in this line:
if (apex < gate && nadir > range)
Currently it will make an item active when its top (apex) is at the bottom of the screen or above. Change to
0.5*gate
if you want it when entering the middle. The other condition is set to make it active after the item’s bottom is going beyond the height of the top menu which was stored in therange
variable near the end of the script. Can also be changed to any other value you like. -
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.