It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Hlep to floting div for firefox browser

Hlep to floting div for firefox browser

Postby raj2476 on Sat Jun 14, 2008 6:30 am

Hi all,

Here i have pasted my floting div javascript which is working fine in IE but it's not working in Firefox browser. Please help me out check this code and let me know why is this not working in Firefox.


while it would floting in firefox it should be fixed position right side in the table itself.

PLZ HELP ME SOONNNNNNNNNNNNNN

Thanks
Raj


<SCRIPT language="JavaScript" type="text/javascript">
// ----------------------------------------
// Detectind user browser
// ----------------------------------------
var Nav = navigator, Ag = Nav.userAgent;
var bIE = (Ag.indexOf('MSIE') >= 0), bMacIE = false;
var bNC = (navigator.appName == "Netscape");
var bOpera = (Ag.indexOf('Opera') >= 0);
var nVer = 0, sTmp = "";
if (bIE) {
sTmp = Ag.substring(Ag.indexOf("MSIE") + 5, Ag.length);
nVer = Math.floor (sTmp.substring(0, sTmp.indexOf(";")));
if (nVer >= 4 && !document.all)
nVer = 0;
if (Ag.indexOf("Mac") >= 0)
bMacIE = true;
}
if (bNC)
nVer = Math.floor (Nav.appVersion.substring (0, Nav.appVersion.indexOf (" ") ) );

bDynamic = (document.all || document.layers) ? true : false;

// ----------------------------------------
// Menu moving functions
// ----------------------------------------
nMenuYPos = 97;
nYDelta = 0;
nPrevScrollPos = 0;

function Spy () {
if (bNC && nVer >= 4) {
if (window.pageYOffset < nMenuYPos - nYDelta)
nNeededPos = nMenuYPos;
else
nNeededPos = window.pageYOffset + nYDelta;
nCurrentPos = document.layers["floatingmenu"].top;

if (nNeededPos == nCurrentPos)
return;

nCurrentPos += Math.round ( (nNeededPos - nCurrentPos) / 4);
document.layers["floatingmenu"].top = nCurrentPos;
}

if (bIE && nVer >= 4 && !bMacIE) {
if (document.body.scrollTop < nMenuYPos - nYDelta)
nNeededPos = nMenuYPos;
else
nNeededPos = document.body.scrollTop + nYDelta;
nCurrentPos = document.all["floatingmenu"].offsetTop;

if (nNeededPos == nCurrentPos)
return;

nDelta = (nNeededPos - nCurrentPos) / 6;
if (nDelta > 0 && nDelta < 0.5)
nCurrentPos += nNeededPos - nCurrentPos;
else
if (nDelta < 0 && nDelta >= -0.5)
nCurrentPos --;
else
nCurrentPos += Math.round (nDelta);

pnt = document.all ["floatingmenu"].style;
pnt.top = nCurrentPos;
}
}

function ScriptStart () {
if (bNC && nVer >= 4)
setInterval ("Spy ()", 10);
if (bIE && nVer >= 4 && !bMacIE)
setInterval("Spy ()", 10);


}

bScriptLoaded = true;
</SCRIPT>

<body onload="ScriptStart ();">
raj2476
 
Posts: 12
Joined: Sat Jun 14, 2008 6:21 am
Location: Hyderabad

Postby rangana on Sat Jun 14, 2008 8:00 am

IE and FF both throwing a good number of errors at my end.
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines

Postby raj2476 on Sat Jun 14, 2008 8:24 am

Hi Rangana help me na why it's not working in firefox. see the rul www.resourcepoint.net in firefox browser and let me know soon plzzzzzzzzzzzzz
raj2476
 
Posts: 12
Joined: Sat Jun 14, 2008 6:21 am
Location: Hyderabad

Postby rangana on Sat Jun 14, 2008 9:06 am

Your code considers the obsolete browsers (Netscape) which I'm having difficulty moving into a cross-browser script since I'm not seeing any effect.

You might find DD useful for your DHTML/HTML/AJAX needs ;)

Hope it keeps you going.
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines

Postby raj2476 on Sat Jun 14, 2008 10:53 am

Thanks Rangana but could u send me link any floating div which will work for firefox and ie and fixed in the table also
raj2476
 
Posts: 12
Joined: Sat Jun 14, 2008 6:21 am
Location: Hyderabad

Postby rangana on Sat Jun 14, 2008 10:58 am

User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines

Postby raj2476 on Sat Jun 14, 2008 12:02 pm

Hi Rangna,

Thanks for ur reply, this code is working for both browser but what i need is, it should fixed there while floting. make it right align, it will float in right side of the browser. If u will make ur browser window small side then also it will float right side cornor of the browser but i don't want like this i need it should fix there it self if u will check in different resolution also it should be fixed in the same position. I want that type of code which would work for both browser. thanks if u would give me that type of floating script. plz give me if u could find like that any ...............
raj2476
 
Posts: 12
Joined: Sat Jun 14, 2008 6:21 am
Location: Hyderabad

Postby rangana on Sat Jun 14, 2008 12:40 pm

I've created one for you. Hope this helps:
Code: Select all
<script type="text/javascript">
/**************************************
* Script by Raymond Angana
* rangana in Devppl.com/forum
* Title: Floating script cross-browser
* Created: June 14, 2008
* This notice must stay intact
/**************************************/
window.onresize=adRangjust;
window.onload=adRangjust;
function adRangjust()
{
   var adfloat='right', // Change the value to left if you want it to float on left
   topmar=10, // Margin from the top of the screen
   sidemar=10, // Margin from the sides
   bh=document.body.clientHeight, // Find the clients height
   bw=document.body.clientWidth, // Find the clients width
   pos='absolute', // Choose from these three pos value: absolute, fixed, relative
   mydiv=document.getElementById('myfloatingdiv'); // ID of your floating div
   
   /*****************No need to edit beyond this part***************/
   
   mydiv.style.position=pos;
   mydiv.style.top=topmar+'px';
   if(adfloat=='right') mydiv.style.right=sidemar+'px';
   else mydiv.style.left=sidemmar+'px';
   
}
</script>
<div id="myfloatingdiv" style="padding:10px;width:100px;border:1px solid #222;">
This is my floating div. It stays in this position and adjust on screen's height and width.
</div>
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines

Postby raj2476 on Mon Jun 16, 2008 10:53 am

Hi Rangana,

Thanks for keep in touch. Still am there, am not getting the right code. just u ckech this url in IE www.resourcepoint.net. how it is floating right side in 1280 resolution. if u would check in 1024 resolution then also it won't move from his place. like that i want to work for FireFox Browser which is not working now.

Plz help me to get a right code. am also searching.

Waitiig for ur positive Reply

Thanks
Raj
raj2476
 
Posts: 12
Joined: Sat Jun 14, 2008 6:21 am
Location: Hyderabad

Postby raj2476 on Wed Jun 18, 2008 8:27 am

Hi,

Anybody is there who could help me out? just check this url in IE & FireFox www.resourcepoint.net. that right side floating table it's working fine in IE But in firefox it's not working and u view in any resolution it won't change from his position. i have pasted that div in td.

Plz help me out since last few days am trying for this but am not getting the right solutions.

Thanks
raj2476
 
Posts: 12
Joined: Sat Jun 14, 2008 6:21 am
Location: Hyderabad

Next

Who is online

Users browsing this forum: No registered users and 9 guests