Come back in this studio you would be adding some more JELAS glib in get given section in the studio.
I will be adding some Della's script to make the menu item active on click event.
For example if I click on screen it brings the user to the screen fiction but the screen menu item is
not active there just make it active on the use of click event
active menu icon on click
document Cardellini function
inside that ad.
Use strict.
Mark
and I need to access
the menu item like not bar.
No and say deaded is a list item.
And inside that there is the anchor desk when this anchor tag is clicked.
It should add and active close to the list item.
And if you remember I do the active glossy assess in the styled archdiocese and this is this will be
applied when the user click on any item.
So I need to access nav bar and say that I have a list item and then ANCHOR Thank You can for me nav
bar can copy it from here.
And then is just here.
So I don't make any mistake not it will access the parent element.
But I think I forget to add the On Click event
on click event
when the user click on the anchor desk which is inside the list I don't open that bar Dashon I have.
I would also use strict more inside this and I need to add
and remove some sucess from the parent element the parent element of anchor tag list elements.
So here we are targeting the list element that an element remove glass and the active has already edged
with the anchor element with the list element with anchor element vetted variant element which is list
item.
You should remove the active Bloss
this line of code or remove the ective clause from any list item which is the parent of anchor element
inside the car.
And it will apply the active clause to the current.
This this dark Beland
dark and glass
red class are
going to show the results of this telescope in the Groser.
To crush it and you know you'll see Oakey and they click on the feature section.
Now you can see the feature the menu item is active.
And if you click on the context menu item you can see the context menu item is active.
You can see the list item the parent element of anchor take is getting the active class
and this is the assist you played in the style narcissist's
So all you can see if you click on any menu item you get the menu item said active
OK let us add some more Javascript on the scroll.
If you see the menu item is not active.
If we want to make the menu item active on the school for example if we use it is on a feature section
the menu item features should be active.
And just good for this
I load menu item on scrolling and document dog reading question
and inside did I ever use trick more.
And on the window
object and Ohlins scroll.
I mean I had a function
and inside dead again I would use trick more and do Dalgard that each section
like this about section the features testimonial properties no section all of the six section and it
can look to each section
and say that I access the id attribute of each section.
For example
this dark attributes and Alexis id attribute
leg ID intruder's about
screens features.
Download and contact so it can be return likes some think about the.
Don't load it.
They just also get to alter the height of current element.
This is the older height the outer returns the height including the padding and border.
You can see this is the older height function
if lower than the outer height of current section which include bedding and water
that is added one another with even greater top and this would be
offset
and Vitt top position
this offshoot will return the retrieve it will retube the current position and then we'll get the position
of the client.
Each section there just subtract some pixels like 50 pixels.
This will allow to retrieve the conclusion using the offset functions and then you'll get the top position.
It's a subtraction of 70 pixels.
Now if
window dog scroll
clock is greater than the top
and
window dart
score
is less than greater top plus height
it should add some C Ss this group of function will return the vertical scroll bar position of the window.
If this is greater than the great top which is the offset which is the current position of the each
section with subtraction of minus 70 which is if it is greater than and if the wounded are scored top
is less then with greater topless height.
Exists the current section like
dot net
net and say that is a list item and this is the anchor that can say list Hatim and you need to filter
the anchor tag like him it should have
and I need to add the B-B variable less
closing backwards
does not.
It is.
Plus.
Anchorages should be this and this.
So let me explain it or what it will return.
It will look like what example if if place this is true if it is on a boat section it will look like
this ball
so it will access the current section.
If they use it it's got a boat.
They leave you a place to get the boat.
And if they use it on them don't load on the content section including place with the contact or don't
load sections.
So a little sexist the parent element of Krant section PELLANT function
docked at Glaus and gloves and gloss off active
and in else we need to remove these statements because false bends.
We need to remove the if clause.
The move allows let me see it and let us see that isn't it because you refresh it.
And if we use a score do you see these ladies on a boat section about menu item becomes active.
And if they use it is on the features section the feature menu item become active and the same be for
the screens and don't load and contact
and the click you is also working
everything looks fine.
OK.
That's it for the menubar.
I think you're done with the menubar.
And see you in the next video.
Thanks.