View Full Version : Floating Top Bar script modification

11-25-2005, 12:54 PM
I found this script and it seems to have everything i need.

Floating Top Bar script

However, i only want this to appear after the user has scrolled down the page a certain amount.
In a similar way to this page on about.com (view in IE)

Any idea if i can adapt this script to perform like this?

11-25-2005, 09:24 PM
Give these modifications a try - In the configuration area for the script, add this variable (highlight red):

var persistclose=0 //set to 0 or 1. 1 means once the bar is manually closed, it will remain closed for browser session
var startX = 30 //set x offset of bar in pixels
var startY = 5 //set y offset of bar in pixels
var tLimit = 175 //set vertical scroll trigger point for bar's appearance/disappearance, use 0 for always visible
var verticalpos="fromtop" //enter "fromtop" or "frombottom"

Add this function (just above function staticbar):

function restrictbar(){
pageScroll=typeof pageYOffset!=='undefined'? pageYOffset : iecompattest().scrollTop
document.getElementById("topbar").style.display=pageScroll>=tLimit? "block" : "none"
setTimeout("restrictbar();", 200)

Add to function staticbar, like so (addition red):

function staticbar(){
if (tLimit) restrictbar();
var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;
var d = document;
function ml(id){

11-28-2005, 11:26 AM
Your a genius...
That has worked brillaintly.

Many thanks