473,403 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

keeping a menubar on top of the site

Hi folks,

I was trying to "pin" a menubar to the top of a site.
It should allways stay on its absolute position.
Especially when the user scrolls the page...

I did like this:

<div id="object1" style="position:absolute; visibility:left:50px;
top:50px"> MENU </div>

called from a timer:

document.object1.style.top=50;
OR
window.document.object1.style.top=50;
OR
document.object1.top=50;
OR
window.document.object1.top=50;

none of them worked...
now what?
THX!
M. Hesselbach

PS: It's ok if it runs in firefox, no need for IE support...
Jul 23 '05 #1
4 1682
Martin Hesselbach wrote:
I was trying to "pin" a menubar to the top of a site.
It should allways stay on its absolute position.
Especially when the user scrolls the page...
Is is it that hard for the user to scroll back up?
<div id="object1" style="position:absolute; visibility:left:50px;
top:50px"> MENU </div>
visibility what?
called from a timer:

document.object1.style.top=50;


That should be document.getElementById('object1') and "50px", but won't do
any good since you are just setting it to what it is anyway.

You probably want position: fixed, not absolute. There wouldn't be any need
for JavaScript at all, but IE doesn't support fixed. Google will reveal
JavaScript to fake position: fixed support in Internet Explorer.
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #2
David Dorward wrote:
Martin Hesselbach wrote:

I was trying to "pin" a menubar to the top of a site.
It should allways stay on its absolute position.
Especially when the user scrolls the page...

Is is it that hard for the user to scroll back up?

<div id="object1" style="position:absolute; visibility:left:50px;
top:50px"> MENU </div>

visibility what?

called from a timer:

document.object1.style.top=50;

That should be document.getElementById('object1') and "50px", but won't do
any good since you are just setting it to what it is anyway.

You probably want position: fixed, not absolute. There wouldn't be any need
for JavaScript at all, but IE doesn't support fixed. Google will reveal
JavaScript to fake position: fixed support in Internet Explorer.


Still not working....

this is just for trying to move a DIV:
<html><body>
<div id="object1" style="position:absolute; left:50px; top:50px">
<a href="javascript:document.getElementById('object1' ).style.top=60px">
Movable Menu</a>
</div></body></html>

is doing nothing in IE or Firefox...
won't work without the ".style" part neither...

this shouldnt be that hart, ey?

thx again

M. Hesselbach
Jul 23 '05 #3
Martin Hesselbach wrote:
<div id="object1" style="position:absolute; left:50px; top:50px">
So you're ignoring everything I said about not using absolute and JavaScript
for this then?
<a href="javascript:document.getElementById('object1' ).style.top=60px">


1: http://jibbering.com/faq/#FAQ4_24

2: Strings, like 60px, must be surrounded by quote marks in JavaScript.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #4
David Dorward wrote:
Martin Hesselbach wrote:

<div id="object1" style="position:absolute; left:50px; top:50px">

So you're ignoring everything I said about not using absolute and JavaScript
for this then?

<a href="javascript:document.getElementById('object1' ).style.top=60px">

1: http://jibbering.com/faq/#FAQ4_24

2: Strings, like 60px, must be surrounded by quote marks in JavaScript.

thx

works like this now:

function pinScroll() {
pindelay = setTimeout('pinScroll()',50);
document.getElementById('chordsbar').style.top=(wi ndow.pageYOffset+3)+'px';

}

<div id='chordsbar' style='position:absolute'>
its acctually for a lyrics and chords/tabs displaying page...
it scrolls trough the song and the displayed chords you have to play
stay...
M. Hesselbach
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Raphael Gluck | last post by:
Hi I am wondering if anyone can help me I am trying to build a menu bar navigation for my site, and would like the contents of the menu bar to be linked to a database. E.G If I have ten...
15
by: Code Monkee | last post by:
How can the toolbar and menubar be hidden in IE? When opening the window via javascript I can specify 'toolbar=no,menubar=no', which works fine. However if the window already exists how can I...
3
by: NoSpammingToMePlease | last post by:
Assume that this page www.externalsite.com/anypage.html would contain the following javascript: window.open('www.mysite.com/mypage.html', null, 'location=no, menubar=no'); Then I would like to...
6
by: Biguana | last post by:
Hi, Just wondering if anyone can help here. We have a site where most of the site opens in a window with no toolbars or menubar: window.open('mypage.aspx','self','toolbar=0, menubar=0, etc,...
1
by: Richard Hollenbeck | last post by:
I'm building custom menubars for my application--a different one for each form. When I right-click on a menubar and select Customize and click on the toolbars tab, the menubar called "Menu Bar"...
8
by: Jho | last post by:
Is it wise to do the following to hide html source and other info. I plan to do a popup window which would close my existing web page and popup a window in its place without toolbar and...
0
by: Mohit Vora via .NET 247 | last post by:
When I load a child form inside an MDI parent, the menubar of the parent covers the child somehow. The MDI parent is set to FormWindowState.Normal and has MaximizeBox, MinimizeBox and ControlBox...
2
by: A.J. Pool | last post by:
I have a form with a main menubar containing a number of menu options. In the empty right half of the menubar I want to place a combobox where users can make some sort of selection. However, when...
4
by: dreamamit2001 | last post by:
Hi, I would like to know the ASP.NET2.0's(Controls, Menubar, Validations, Object Data Souce Controls, Treeview Control) compatibility with IE5.0 browser on Mac OS. If I don't use Client side...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.