Question

Floating menu relative to point in web page content.

Asked by: mattisimo

Hi,

I am trying to develop a floating menu that will move along the x axis relative to the page content.  The site will be 800x600 and centred on the page, and I am looking to have the menu float up and down in a defined area of the page.  Viewing the page at 1024x768, however, menans that the menu's give coordinates are no longer within this area.

Is it possible to 'anchor' it to a point from which it's positional reference can be calculated from?  I would ideally like to insert a point on the page so that irrespective of screen resolution, the menu will still appear at teh designated position.

Also, is it possible to find out the x,y coordinated of the <div> / <layer> to reference pop up menu component positions so that as the menu floats down the page, the the popups remain in position relative to the menu?

Sorry if I am a little confusing with my explanation of my problem, as you can imagin I do not totally understand it :).

Any guidance on any of these points would be greatly appreciated.

Matt.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2003-02-27 at 07:12:13ID20532161
Tags

floating

,

menu

,

relative

Topic

Miscellaneous Web Development

Participating Experts
4
Points
75
Comments
6

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Floating div
    I have 3 stylesheets controlling the look of my site (one for layout, one for style and the other for prints). They are referenced as follows: <link rel="stylesheet" type="text/css" href="/CSS/style.css" media="screen, projection, print&...
  2. Floating <div> not floating.....
    My code is supposed to popup a floating box with some information when mouseover a datagrid row. The <div> is populated correctly on mouseover, but instead of being above the datagrid row, it is fixed in the upper left corner of the page. Please take a look and recoom...
  3. Display:Block/None shifts floating divs
    Hi, I am displaying 2 divs side by side using float:left, and am using relative positioning. That works fine, the divs show up side by side correctly. However, I also need to show/hide the divs and am using display:block and display:none. When I display the right div with ...
  4. floating popup window
    Hello experts, I need a good recource for floating, popup killer resistent windows, to embed in a ecommerce shop. Something like the popular FERANT windows. Need to have a proffessionel lokk....any recommendations? I appriciate Dimi
  5. Content floating out of div
    I am trying to contain my wordpress blogposts in my maincontent div, but it seems that over 3 posts will make it float beneath the floatet div. I wanted all divs in the main content area to have 100% with so the would follow the posts, no matter how much text they consist of...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: hexagon47Posted on 2003-02-27 at 09:05:53ID: 8035019

<html>
<head>
<script type="text/javascript">
<!--
function checkAndDisplay()
{
if ((screen.width>=1024) && (screen.height>=768))
{
document.getElementById('floatingDiv').style.pixelLeft =500;
document.getElementById('floatingDiv').style.pixelTop =200;
document.getElementById('floatingDiv').style.display ='block';
}
else
{
...
}
}
//-->
</SCRIPT>
</head>
<body onload="checkAndDisplay()">
<div id="floatingDiv" style="left:0px; top:0px; position:absolute; width:150px; display:none; background-color:#696969; border:1px solid black">my floating menu</div>
</body>
</html>

obviously you will have to play around with the values  bit

did it help?

 

by: zerofillPosted on 2003-02-27 at 13:35:33ID: 8037120

There is no need of Javascript. It is also too relative because there is no garantee that you can take user's resolution.
You can solve your problem in this way:
Create your page and where you want to put the menu insert a table. Put the <div></div> into the table and it will be restricted to  borders of that table.
Here is an exaple code:
<table width="770" border="1" align="center">
  <tr>
    <td> &nbsp;
      <div id="Layer1" style="position:absolute; width:200px; height:16px; z-index:1">Text in div</div>
      </td>
  </tr>
</table>

!!! Do not set left: X px; top: Y px because it will depend on how far from border of the browser is, which is your problem. In the other case it will depend on table's borders.
Hope this help

 

by: MusicManPosted on 2003-03-02 at 16:24:08ID: 8054089

Mattisimo,
Here is a nice scrlling menu using a mix of DHTML, JAVA and style sheets.  It will float the menu at the top left of the page, but it position can be changed by altering the relevant values.  I think you pop up problem may be a bit harder to solve though.

MM



<style TYPE="text/css">
#slide {
                Position: Absolute;
                Left: 5;
                Top: 5;
                Visibility: Visible;
                }

A:LINK            {text-decoration: none;}
A:VISITED      {text-decoration: none;}
TD            {font-family:arial;}
BODY            {Margin-Left: 120;}

</style>
<span ID="slide">

<table CELLSPACING="0" BORDER="0" CELLPADDING="0" ALIGN="LEFT" >
<TR><td><HR NOSHADE></TD></tr>
<tr>
<td><A HREF="url 1">option 1</A><BR></td>
</TR>
<tr>
<td><A HREF="url 2">option 2</A><BR></td>
</tr>
<tr>
<td><A HREF="url 3">option 3</A><br></td>
</tr>
<tr>
<td><A HREF="url 4">option 4</A><br></td>
</tr>
<tr>
<td><A HREF="url 5">option 5</A><br></td>
</tr>
<TR><td><HR NOSHADE></TD></tr>
</table>
</span>

<script LANGUAGE="JavaScript">

        self.onError=null;
       
        currentX = currentY = 0;  
        whichIt = null;          
        lastScrollX = 0; lastScrollY = 0;
       
        NS = (document.layers) ? 1 : 0;
        IE = (document.all) ? 1: 0;
       
        function heartBeat() {
       
                if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
            if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }
               
                if(diffY != lastScrollY) {
                        percent = .1 * (diffY - lastScrollY);
                        if(percent > 0) percent = Math.ceil(percent);
                        else percent = Math.floor(percent);
                                        if(IE) document.all.slide.style.pixelTop += percent;
                                        if(NS) document.slide.top += percent;
                        lastScrollY = lastScrollY + percent;
            }
                if(diffX != lastScrollX) {
                        percent = .1 * (diffX - lastScrollX);
                        if(percent > 0) percent = Math.ceil(percent);
                        else percent = Math.floor(percent);
                        if(IE) document.all.slide.style.pixelLeft += percent;
                        if(NS) document.slide.left += percent;
                        lastScrollX = lastScrollX + percent;
                }      
        }

        function checkFocus(x,y) {
        var totalY, totalX;
                floatx = document.slide.pageX;
                floaty = document.slide.pageY;
                floatwidth = document.slide.clip.width;
                floatheight = document.slide.clip.height;
                       
                        if(20 == 0) totalY = floatheight;
                        else totalY = 20;
                        if(0 == 0) totalX = floatwidth;
                        else totalX = 0;
                if( (x > floatx && x < (floatx+totalX)) && (y > floaty && y < (floaty+totalY))) return true;
                else return false;
        }
       
        function grabIt(e) {
                if(IE) {
                        whichIt = event.srcElement;
                        while (whichIt.id.indexOf("slide") == -1) {
                                whichIt = whichIt.parentElement;
                                if (whichIt == null) { return true; }
                    }
                        whichIt.style.pixelLeft = whichIt.offsetLeft;
                    whichIt.style.pixelTop = whichIt.offsetTop;
                        currentX = (event.clientX + document.body.scrollLeft);
                        currentY = (event.clientY + document.body.scrollTop);
                       
                        if(20 == 0) totalY = whichIt.style.pixelHeight;
                        else totalY = 20;
                        if(0 == 0) totalX = whichIt.style.pixelWidth;
                        else totalX = 0;
                        if(!(event.clientX > whichIt.offsetLeft && event.clientX < whichIt.offsetLeft + totalX) ||
                        !(currentY > whichIt.offsetTop && currentY < whichIt.offsetTop + totalY)) whichIt = null;
                } else {
                window.captureEvents(Event.MOUSEMOVE);
                if(checkFocus (e.pageX,e.pageY)) {
                        whichIt = document.slide;
                        FloatTouchedX = e.pageX-document.slide.pageX;
                        FloatTouchedY = e.pageY-document.slide.pageY;
                }
                }
            return true;
        }
       
        function moveIt(e) {
                if (whichIt == null) { return false; }
                if(IE) {
                    newX = (event.clientX + document.body.scrollLeft);
                    newY = (event.clientY + document.body.scrollTop);
                    distanceX = (newX - currentX);    distanceY = (newY - currentY);
                    currentX = newX;    currentY = newY;
                    whichIt.style.pixelLeft += distanceX;
                    whichIt.style.pixelTop += distanceY;
                        if(whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop;
                        if(whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft;
                        if(whichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;
                        if(whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5;
                        event.returnValue = false;
                } else {
                        whichIt.moveTo(e.pageX-FloatTouchedX,e.pageY-FloatTouchedY);
                if(whichIt.left < 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset;
                if(whichIt.top < 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset;
                if( (whichIt.left + whichIt.clip.width) >= (window.innerWidth+self.pageXOffset-17)) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;
                if( (whichIt.top + whichIt.clip.height) >= (window.innerHeight+self.pageYOffset-17)) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;
                return false;
                }
            return false;
        }
       
        function dropIt() {
                whichIt = null;
            if(NS) window.releaseEvents (Event.MOUSEMOVE);
            return true;
        }

       
        if(NS) {
                window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);
                window.onmousedown = grabIt;
                window.onmousemove = moveIt;
                window.onmouseup = dropIt;
        }
        if(IE) {
                document.onmousedown = grabIt;
                document.onmousemove = moveIt;
                document.onmouseup = dropIt;
        }
       
       
        if(NS || IE) action = window.setInterval("heartBeat()",1);
       

</script>

 

by: COBOLdinosaurPosted on 2003-09-12 at 19:02:22ID: 9350324

This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

<note>
Unless it is clear to me that the question has been answered I will recommend delete.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp


Cd&

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...