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 HTML Forum

Copyright Page Footer Div?

Copyright Page Footer Div?

Postby dflynn on Sat Dec 22, 2007 2:06 am

Hey, back again fo more layer help.
Is there a way to get a <div> layer to stick to the bottom of the page?
I've been searching for hours and came back with nothing.

Thanks,
User avatar
dflynn
500+ Club
 
Posts: 860
Joined: Wed Oct 03, 2007 9:06 pm
Location: Guelph, Canada

Postby webmaster on Sat Dec 22, 2007 11:12 am

How do you mean when you want it to stick there. Even when you scroll,it should always be there?
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby leonard on Sat Dec 22, 2007 11:17 am

hey dflynn

I guess you don't want to use frames, right?

I have taken the javascript-code of our forum (http://www.devppl.com/forum) and modified it a bit.
There might be better ways for having such a footer-layer, but as this page provides what you ask for, here is my modified version:

Code: Select all
<html>
<script type="text/javascript" charset="UTF-8">
var displaymode='always'
var enablefade='no'
var autohidebox=['no', 0]
var IEfadelength=1
var Mozfadedegree=0.05
if (parseInt(displaymode) != NaN)
var random_num = Math.floor(Math.random() * displaymode)

function displayfadeinbox()
{
  var ie = document.all && !window.opera
  var dom = document.getElementById
  iebody = (document.compatMode == 'CSS1Compat') ? document.documentElement : document.body
  objref = (dom) ? document.getElementById('layer') : document.all.hoverprompt
  var scroll_top = (ie) ? iebody.scrollTop : window.pageYOffset
  var docwidth = (ie) ? iebody.clientWidth : window.innerWidth
  docheight = (ie) ? iebody.clientHeight: window.innerHeight
  var objwidth = objref.offsetWidth
  objheight = objref.offsetHeight
  objref.style.left = docwidth/2-objwidth/2+'px'
  objref.style.top = scroll_top+docheight/2-objheight/2+'px'
  showonscrollvar = setInterval('staticfadebox()', 50)

  if (objref.style.MozOpacity)
  {
    objref.style.MozOpacity = 1
    controlledhidebox()
  }
  else
  {
    controlledhidebox()
  }
}

function staticfadebox()
{
  var ie = document.all && !window.opera
  var scroll_top = (ie) ? iebody.scrollTop : window.pageYOffset
  objref.style.top = scroll_top+docheight-objheight+'px'
}

function hidefadebox()
{
  objref.style.visibility = 'hidden'
  if (typeof showonscrollvar != 'undefined')
  clearInterval(showonscrollvar)
}

function controlledhidebox()
{
  if (autohidebox[0]=="yes")
  {
    var delayvar = (enablefade == 'yes' && objref.filters) ? (autohidebox[1]+objref.filters[0].duration)*1000 : autohidebox[1]*1000
    setTimeout('hidefadebox()', delayvar)
  }
}

function initfunction()
{
  setTimeout('displayfadeinbox()', 100)
}


if (displaymode == 'always' || parseInt(displaymode) != NaN && random_num == 0)
{
  if (window.addEventListener)
  {
    window.addEventListener('load', initfunction, false)
  }
  else if (window.attachEvent)
  {
    window.attachEvent('onload', initfunction)
  }
  else if (document.getElementById)
  {
    window.onload = initfunction
    document.cookie = 'fadedin=yes'
  }
}
</script>

<body>
<div id='layer' style="position:absolute">My Footer-LAYER</div>
<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><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><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br>
</body></html>


I'm sure that you can delete a bit more of the code so that it suits to your need.
One thing: If I encounter such things, I usually disable the JavaScript, because I am not a fan of this stuff :-).

cheers!
- leonard
:%s/^M//
There are 10 kinds of people:
Those who understand binary and those who don't.
User avatar
leonard
100+ Club
 
Posts: 147
Joined: Tue Dec 18, 2007 7:11 am
Location: Switzerland

Postby dflynn on Sat Dec 22, 2007 6:19 pm

Webmaster: I want it to stay below everything else on the page. Not something that sticks to the edge of the browser and stays around while you scroll.

Leonard: Thanks for the script, I will try it out tonight when I get home. I didn't want a frame since the pages on this site are going to be longer than a browser length (on most computers)so I wanted the copyright to sit at the very end of the page. This would be easy with tables but div layers like to make life tricky for me
User avatar
dflynn
500+ Club
 
Posts: 860
Joined: Wed Oct 03, 2007 9:06 pm
Location: Guelph, Canada

Postby leonard on Sat Dec 22, 2007 7:56 pm

Oops, like webmaster, I thought you meant a layer that sticks to the end of the visible screen, even if you scroll.

If you want it at the bottom of the HTML-page you can try this:
It works if you don't use other layers:

Code: Select all
<html>

<head>
<script type="text/javascript">

function placeFooter() {
  bodyHeight = document.getElementsByTagName('body')[0].offsetHeight;
  document.getElementById('footer').style.top  =  bodyHeight + 'px';
  document.getElementById('footer').style.visibility = 'visible';
}

</script>
</head>


<body onload="placeFooter();">

<div id="footer" style="position:absolute;visibility:hidden">my footer</div>
<br>
<span>MY WEBPAGE</span>
</body>
</html>


cheers
- leonard
:%s/^M//
There are 10 kinds of people:
Those who understand binary and those who don't.
User avatar
leonard
100+ Club
 
Posts: 147
Joined: Tue Dec 18, 2007 7:11 am
Location: Switzerland


Who is online

Users browsing this forum: No registered users and 11 guests