Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Background image centered, and context menu overflow

Posted on 2005-02-27
2
Medium Priority
?
847 Views
Last Modified: 2012-05-05

GO TO : http://www.jussieu.org/divpb/

I explain my problem. To resume, i have a background-image centered for my BODY.

I have a div that is centered too inside this body.

I use a "www.dhtml-menu.com" context menu. When i "right-click" near a border of my window, context menu is displayed outide the window, so window is resized and backgound image is recentered depending of the new global window size (even if lift cursor appear). BUT div inside is not resized depending of the size of the document. It stay centered depending on the content of what is displayed.

How to resize my div the way the backgound do, or how to keep background image centered to what is displayed and not global window size.
0
Comment
Question by:eeolivier
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Accepted Solution

by:
arantius earned 2000 total points
ID: 13416068
Online demo: http://www.arantius.com/ee/Q_21330993.html

<HTML>
<head>
      <base href="http://www.jussieu.org/divpb/" />
      <title>Javascript Context Menu Ex.#8 - dhtml popup menu mode</title>

      <!-- Apycom DHTML Menu -->
      <noscript><a href=http://dhtml-menu.com/>DHTML Menu, (c)2004 Apycom</a></noscript>
      <script type="text/javascript" language="JavaScript1.2" src="apymenu.js"></script>
      <script type="text/javascript" language="JavaScript1.2" src="data-popup.js"></script>
      <script type="text/javascript" language="JavaScript1.2" src="data-popup2.js"></script>
      <!-- Apycom DHTML Menu, dhtml-menu.com -->

      <style>
      body {
            margin: 0;
            height: 100%;
      }
      #holder {
            width: 100%;
            min-height: 100%;
            background-image: url(img/bg.gif);
            background-repeat: repeat-y;
            background-position: center;
            text-align: center;
      }
      * html #holder {
            height: 100%;
      }
      </style>
</head>

<body bgcolor=#FFFFFF onContextMenu="return apy_popup(1, 1000, event);">
<div id="holder">
      <div style="width: 784px;margin: 0 auto;width: 784px;text-align: center;">
            THIS SHOULD STAY CENTERED ALWAYS<br><br>
            Display this window in order to see gray backgound left and right<br><br>
            Put you mouse near the right of the window. Right CLICK. A context menu should appear.
            But it appear out of the window. BUT !!! Background that is centered reajust , but not
            the DIV that contain what your are reading. How to dynamically center this div even if it is
            clicked near the border of the screen ? What javascript to raise ?
      </div>
</div>

</body>
</html>
0
 
LVL 32

Expert Comment

by:Batalf
ID: 13416073
It's a better solution to modify your right click menu so that it would show at the left side of the mouse cursor when you're at the right edge of the window.

Batalf
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question