Jump to content

shrink logo img on scroll in nav bar


pretesh
 Share

Recommended Posts

On the W3Schools website page 'How TO - Shrink Navigation Menu on Scroll' tutorial it shows how to use Javascript to shrink the nav-bar. The 'CompanyLogo' also shrinks but this is text not an actual logo.

What kind of Javascript would I need for a shrinking logo that was for example a jpg image?

Is this a difficult thing to do?

Any help on this would be great as I want to do this for my own website design and I'm new to Javascript.

Link to comment
Share on other sites

Take a look at the Try-It. Can you see how its changing the 'logo'?

https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_navbar_shrink_scroll

I noticed that it uses JavaScript to directly change the font-size of the 'logo'.

If you used an image you could change the width of the image to resize it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...