Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8821369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:50:12+00:00 2026-06-14T05:50:12+00:00

I have followed this post in order to make a button similar to dropbox

  • 0

I have followed this post in order to make a button similar to dropbox‘s log in button.

More specifically, here is the code I am using:

echo '<a href="#" id ="loginbutton"></a>';

    echo '<div id = "popup">';
    echo '<div id = "popupimage"> </div>';

//HTML INSIDE POPUP

    echo '</div>';

    echo '<script type="text/javascript" src="jquery.js"></script>';
    echo '<script>';

    echo '$("#loginbutton").click(function(e){';
    echo '$("#popup").css("visibility","visible");';
    echo 'e.stopPropagation();';
    echo '});';

    echo '$("#popup").click(function(e){';
    echo 'e.stopPropagation();';
    echo '});';

    echo '$("body").click(function(e){';
    echo '$("#popup") . css("visibility", "hidden");';
    echo '});';

CSS:

#logbutton{
    top:50px;
    left:850px;
    position: absolute;
    background-image: url(../images/buttons/loginbutton.png);
    width:59px; 
    height:28px;   
}

#popupimage{
    top:63px;
    left:887px;
    position: absolute;
    background-image: url(../images/popupimage.png);
    visibility: hidden;
    width:400px; 
    height:600px;   
}

The button works and the popup appears too.

The css of popup image specifies an absolute position of where the image is going to appear, and it is this that is causing the problem. I now wish to add some dynamic content before the button, and therefore I cannot really tell at which location the button is going be. This results in the popupimage not being placed near the button.

Is it is possible to know the absolute position of the button so that I can set my popupimage (using jquery) to appear next to it. Remember that since I have dynamic text before, it does not have a constant fixed position.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:50:13+00:00Added an answer on June 14, 2026 at 5:50 am

    Why not do what dropbox did and wrap the button and the popup in a position: relative; positioned element? The relative positioned element will flow with the dynamic content but the position: absolute; elements within it will automatically be relative to the wrapper position. This is much simpler than trying to figure it out via jQuery.

    UPDATE

    # CSS
    .position_me_relative {
      position: relative;
    }
    .within_the_relative_wrapper {
      /* 
       This will flow inside the wrapper like a normal element.
       For example, it will obey any padding you apply to the parent element.
      */
      position: relative; 
    }
    .absolute_popup_relative_to_wrapper {
      /* As an example:
        This will position the popup so its lower right corner
        is touching the lower right corner of the wrapper regardless
        of where the wrapper shows up on the page.
      */ 
      position: absolute;
      bottom: 0px;
      right: 0px;
      /*
        top and left can also be used for positioning
        negative values can also be used and the absolute element
        can be positioned so it appears "outside" the wrapper element
        i think if you play around with some different values for 
        top, bottom, left and right you'll get the idea pretty quick
      */
    }
    
    # Markup
    <div class="position_me_relative">
      <a class="within_the_relative_wrapper"></a>
      <div class="absolute_popup_relative_to_wrapper"></div>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi have followed this tutorial using Core plot framework http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application My project compiles, but
I have followed this tutorial here as mentioned exactly I now try to run
I'm using Xcode 4.3 and I have followed this user's steps to create the
I followed this guide here perfectly and have gone through it again but when
I have followed the suggestion in this question as I am using Django, I
I have followed this blog post: url to integrate less with Umbraco. Also, while
I have followed the suggestions from this post to try and get Distinct() working
I followed this post here and sorted out how to set the ForeignKey of
I have visited so many similar links like this i.e 1 , 2 followed
I have followed this guide for PHP Twitter Apps by OAuth Here in test.php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.