We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,442 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Smart Mind "FLOAT EVERYTHING"

0
By iamrashid on Nov 20th, 2005 7:48 am

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>

Its Really Great:p

iamrashid
Newbie Poster
7 posts since Jul 2005
Reputation Points: 12
Solved Threads: 0
Skill Endorsements: 0

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0951 seconds using 2.77MB