SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2002
    Location
    Scotland, UK
    Posts
    530
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DHTML to place a layer at the bottom right of the page

    Hi folks,

    Im looking for a script that will place a layer at the bottom right of the page. Ive done this with using BOTTOM: 1px and RIGHT: 1px but if the user scrolls down the page the layer doesnt automatically slide down to sit at the bottom.

    Ive seen a script that does this a year ago on the Adobe website (a feedback script) but cant find it now.

    Can someone help me out, thanks.

    R.

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's one way to do it
    Code:
    <head>
    <style type="text/css">
    div#blah {
    	right: 1px;
    	bottom: 1px;
    	width: 200px;
    	height: 200px;
    	border: 1px solid #999;
    	background-color: #EEE;
    	}
    </style>
    
    <script type="text/javascript">
    function doStatic() {
    	if (!document.all) return;
    	var o = (document.getElementById || document.all)('blah');
    	o.style.bottom = 1 + parseInt(document.body.scrollBottom) + 'px';
    	}
    window.onscroll = doStatic;
    window.onresize = doStatic;	
    </script>
    
    </head>
    
    <body onLoad="document.getElementById('blah').style.position=(document.all)?'absolute':'fixed';">
    
    <div id="blah"></div>
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev





Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •