The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
vBulletin Javascript issue in IE
This is a piece of code I created as a cross-brower/cross-platform solution for fixing/locking a div on a custom vB page (so that it scrolls along with the page scrolling). However, when adding it, it works in all browsers but IE. Unlike the other ones, Internet Explorer cannot seem to get hold of any of the values requested by the code, and required for it to work well. Other functions still work, it is just not getting the offsetTop and window.pageYOffset values.
However, when trying this outside of a vB page, it works great, even on IE, so something from vB seems to be conflicting and I have no idea what it is or how to make it work along with this code. Code:
<script type="text/javascript"> window.onscroll = function (e) { var basediv = document.getElementById('basediv').offsetTop; var setdiv = document.getElementById('setdiv'); if (window.pageYOffset < (basediv - 1)) { setdiv.style.top = "0px"; } else { setdiv.style.top = (1 + (window.pageYOffset - basediv) + "px"); } } </script> The following I have used to test it: Code:
<script type="text/javascript"> window.onscroll = function (e) { var testdiv = document.getElementById('testdiv').offsetTop; alert(window.pageYOffset + " " + testdiv); } </script> <div id="testdiv"></div> Help is very much appreciated! Thanks! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|