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 642309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:09:25+00:00 2026-05-13T21:09:25+00:00

I am working on an interface that requires that the user can click on

  • 0

I am working on an interface that requires that the user can click on a button, and then I will show a floating div positioned relative to the button (you can kind of think of it as the area that shows when you click the down arrow on a dropdown).

How can I correctly position this floating element adjacent to the button which was clicked (which could be anywhere on the page)?

Thanks in advance!!

  • 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-05-13T21:09:25+00:00Added an answer on May 13, 2026 at 9:09 pm
    <input type="button" id="btn" value="Choose Something" />
    
    <div id="select">
      ...
    </div>
    

    with CSS:

    #select { position: absolute; display: none; }
    

    and Javascript:

    $("#btn").click(function() {
      var sel = $("#select");
      var pos = $("#btn").offset();
      if (sel.is(":hidden")) {
        sel.attr({
          top: pos.top + 20,
          left: pos.left
        });
        sel.show();
      } else {
        sel.hide();
      }
    });
    

    Basically you absolutely position the floating div to remove it from the normal flow and then use offset() to figure out where to put it in relation to the button.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a module that requires a strictly decoupled interface. Specifically, after instantiating
I am working on a project that requires the use of user stories and
I'm currently working on an iPhone app that requires the user to accept a
I am working on a project that requires that I create a 2D interface
I'm working on a web interface that requires a large number (hundreds) of DOM
I'm working on an interface with a 3rd party app that basically needs to
I'm working on a project for class that involves generics. public interface Keyable <T>
I am working on BlackBerry user interface. But the BlackBerry UIs are less attractive
I'm working on a Rails application that requires you to be logged in to
I am designing an application that will display dynamically-generated forms to the user who

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.