Jump to content

Ie8 & Javascript Onscroll Event Does Not Work


K_Drive

Recommended Posts

I am trying to get a menu to move with a page when a user scrolls. The menu isn't the problem.I put an onscroll event in the web page's body tag, but IE 8 does not seem to recognize it.This is from my code:

<body onscroll="moveButtonsGroup()" >

The function never gets called. I put a simple alert message in it as follows:

function moveButtonsGroup( ){alert("I got here.")}

I never get the alert message. This works fine in the latest version of FireFox. Does anyone have any information about this?

Link to comment
Share on other sites

The onscroll event might not fire if you use the mouse wheel to scroll (I'm not sure if it does or not), but there's also an onmousewheel event. Other than that, make sure the body is actually what is being scrolled and not an interior div or something like that.

Link to comment
Share on other sites

What is strange is that this works in FireFox.(OK - I have been working with CSS for a couple of years now and have worked on pages that need to work for both IE and FF, so I guess I cannot use the word "strange". Things like this happen all the time! LOL)I found a couple of websites that use a different approach. Instead of using the onscroll event they use CSS positioning. I haven't examined their code in detail yet, but that looks like a better solution right now.Thanks for your reply, JustSomeGuy.==============================Yes - Using CSS positioning really worked well. I used fixed positioning. No use for the onscroll anymore.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...