PDA

View Full Version : Menu js runs ok in Moz FF but not IE



jeddi
Jul 11th, 2009, 06:31 PM
Hi,

I am running a sliding menu on my website and it runs fine on my
Moz FF browser but not in the IE version.

This is the script I am using:
(There is a couple of lines of php at the top
but main bit is javascript)



<PHP
echo '
<div id="divStayTopLeft" style="position:absolute">
<div class="menuH">Top Experts</div>
<ul class="categorylinks">';

foreach ($Links as $Link){
$the_name = str_replace(" ","-",$Link['sc_name']);
echo "<li><a href=\"/im/$the_name/internet-marketing-expert-guru-{$Link['user_id']}.html\">&nbsp;{$Link['sc_name']}</a></li>";
}
echo "</ul></div>";
?>

<script type="text/javascript">

/*

window.moveTo(0,0);
window.resizeTo(screen.width,screen.height);

Floating Menu script- Roy Whittle (http://www.javascript-fx.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use
*/

//Enter "frombottom" or "fromtop"
var verticalpos="frombottom"

document.write('<\/div>')

function JSFX_FloatTopDiv()
{
var startX = 14,
startY = 560;
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function ml(id)
{
var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.left=x+'px';this.style.top=y+'px';};
el.x = startX;
if (verticalpos=="fromtop")
el.y = startY;
else{
el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
el.y -= startY;
}
return el;
}
window.stayTopLeft=function() {
if (verticalpos=="fromtop"){
var pY = ns ? pageYOffset : document.body.scrollTop;
ftlObj.y += (pY + startY - ftlObj.y)/8;
}
else{
var pY = ns ? pageYOffset + innerHeight : Document.body.scrollTop + document.body.clientHeight;
ftlObj.y += (pY - startY - ftlObj.y)/8;
}
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("stayTopLeft()", 10);
}
ftlObj = ml("divStayTopLeft");
stayTopLeft();
}
JSFX_FloatTopDiv();
</script>


To see the menu in action you can visit:
www.expert-world.com/im/ (http://www.expert-world.com/im/)

Please let me knoe if you see how I can get it working for IE users.

thanks.

Amphiluke
Jul 11th, 2009, 08:22 PM
Try to modify the script in the following way. It's not the best solution, but it works in IE as well...

<SCRIPT type=text/javascript>


/*

window.moveTo(0,0);
window.resizeTo(screen.width,screen.height);

Floating Menu script- Roy Whittle (http://www.javascript-fx.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use
*/

//Enter "frombottom" or "fromtop"
var verticalpos="frombottom"

document.write('<\/div>')

function JSFX_FloatTopDiv()
{
var startX = 14,
startY = 560;
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function ml(id)
{
var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.left=x+'px';this.style.top=y+'px';};
el.x = startX;
if (verticalpos=="fromtop")
el.y = startY;
else{
el.y = ns ? pageYOffset + innerHeight : document.documentElement.scrollTop + screen.availHeight;
el.y -= startY;
}
return el;
}
window.stayTopLeft=function()
{
if (verticalpos=="fromtop"){
var pY = ns ? pageYOffset : document.documentElement.scrollTop;
ftlObj.y += (pY + startY - ftlObj.y)/8;
}
else{
var pY = ns ? pageYOffset + innerHeight : document.documentElement.scrollTop + screen.availHeight;
ftlObj.y += (pY - startY - ftlObj.y)/8;
}
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("stayTopLeft()", 10);
}
ftlObj = ml("divStayTopLeft");
stayTopLeft();
}
JSFX_FloatTopDiv();
</SCRIPT>


P.S. I have saved the script from Internet, so, now it doesn't contain php blocks. Though this make no matter...

jeddi
Jul 11th, 2009, 10:54 PM
Thanks - that has helped a lot :)

On the IE version (same goes for Opera), the menu seems to start a lot lower down the screen,
can anything be done to make it closer to the top, like it is in Moz FF. ??

ALSO in the IE version there is a spurious e link
it looks like a repeat of the last letter of the link "more".

Thats a bit odd - it is not in Moz or Opera, can I get rid of that ?

Thanks very much for helping :)

Amphiluke
Jul 12th, 2009, 08:18 AM
As regards menu top position: replace screen.availHeight with document.documentElement.clientHeight everywhere in the script. I made haste yesterday.