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

  • Home
  • SEARCH
  • 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 886187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:01:45+00:00 2026-05-15T13:01:45+00:00

I am working om a menu bar, each menu bar item is an image,

  • 0

I am working om a menu bar, each menu bar item is an image, when user places mouse over menu item a div with submenu will appear.

I want to place div directly under the appropriate image item (no space, and div will hover above all elements), with right side alignment, meaning the right top corner of div should be under bottom right corner of image.

Because I can’t and don’t want to hard code position of divs, i want to do it dynamically.

For now I have this:

$('img').each(function(){                     
   jQuery(this).mouseenter(function(){
     var menuItem = $('#' + this.id + '_menu'); //get the needed div 
     var imgRight = this.offset() + this.width();


   });
 });
  • 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-15T13:01:45+00:00Added an answer on May 15, 2026 at 1:01 pm

    The offset() method has top and left properties, you need use them, example:

    var imgRight = this.offset().left + this.width();
    var imgTop = this.offset().top + this.height();
    

    After that, you will have to give the absolute positioning to the DIVs to place them below the images:

    menuItem.css({
      position:'absolute',
      top: imgTop,
      left: imgLeft,
      zIndex:5000
    });
    

    So your code becomes:

    $('img').each(function(){                     
       jQuery(this).mouseenter(function(){
    
       var menuItem = $('#' + this.id + '_menu'); //get the needed div 
       var imgRight = this.offset().left + this.width();
       var imgTop = this.offset().top + this.height();
    
         menuItem.css({
           position:'absolute',
           top: imgTop,
           left: imgLeft,
           zIndex:5000
         });
    
         // now show the corresponding div
         menuItem.show('slow');
    
       });
    });
    

    More Info:

    http://api.jquery.com/offset/

    • 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 website for a small law office. There's a menu bar
I have the following Django models: Bar, Bistro and Restaurant Each of the above
I am working on a simple desktop application with java. There is a menu
i am trying to create a menu bar using jquery. I am using the
I am currently working on a menu that uses superfish. It is completely customizable
A lot of web sites these days have an option to let the user
I managed to create the menubar in the menu editor by clicking and writing
I am working on a project where I must export a lot of Excel
I'm working on personal project which is basically a code editor. Imagine standard File
I run a browser based game at www.darknovagames.com. Recently, I've been working on reformatting

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.