1,105,263 Community Members

Smart Mind "FLOAT EVERYTHING"

Member Avatar
Reputation Points: 2 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi there is the code for floating some thing (menus image or what ever you want).You can set an specific location for the floating item and when you web page is scrolled down or up the object will float to that position slowly or fastly as you set them, just read the code completly and be sure to make ratings and coments
MAMIAOW
Rashid Mehmood

//MAMIAOW
<html>
<head>
<Title>Floating Menu</title>
</HEAD>
<BODY  background=bg.bmp>


              
<!-- Floating start -->
              
                
                  <DIV id=divMenu 
                  style="VISIBILITY: visible; WIDTH: 10px; POSITION: absolute; TOP: 10px; HEIGHT: 10px">
                  
                    <table><tr><td >
                    INsert_your_Object Here_Here </td></tr></table></DIV>
              <SCRIPT>
    

var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isNS = navigator.appName == "Netscape";

function getRef(id) {
	if (isDOM) return document.getElementById(id);
	if (isIE4) return document.all[id];
	if (isNS4) return document.layers[id];
}

function moveRightEdge() {
	var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck ;


	if (isNS4) {
		yMenuFrom   = divMenu.top;
		yMenuTo     = windows.pageYOffset + 137;  
	} else if (isDOM) {
		yMenuFrom   = parseInt (divMenu.style.top, 10);
		yMenuTo     = (isNS ? window.pageYOffset : document.body.scrollTop) + 30;  //Specify the distance of the  Floating Object from top.
	}
	timeoutNextCheck = 50;

	if (yMenuFrom != yMenuTo) {
		yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 20);//Specify the floating Speed high=0,slow=500. etc 
		if (yMenuTo < yMenuFrom)
			yOffset = -yOffset;
		if (isNS4)
			divMenu.top += yOffset;
		else if (isDOM)
			divMenu.style.left =  120;//Specifies the distance of the floating object from left. 
			
			divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;
			timeoutNextCheck = 0; //Specifies the speed of reaction .
	}
	setTimeout ("moveRightEdge()", timeoutNextCheck);
}

if (isNS4) {
	var divMenu = document["divMenu"];
	divMenu.top = top.pageYOffset + 0;
	divMenu.visibility = "visible";
	moveRightEdge();
} else if (isDOM) {
	var divMenu = getRef('divMenu');
	divMenu.style.top = (isNS ? window.pageYOffset : document.body.scrollTop) + 0;
	divMenu.style.visibility = "visible";
	moveRightEdge();
}

              </SCRIPT>
<!--floating end--!>

<br><br><br><br><br><br><br><br><br><br><br><br><br>Scroll down<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>v<br>dc
  </BODY>
</HTML>
Member Avatar
iamrashid
Newbie Poster
7 posts since Jul 2005
Reputation Points: 2 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Its Really Great:p

You
Post:
Start New Discussion
Tags Related to this Article