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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:48:48+00:00 2026-06-15T05:48:48+00:00

I have a menu in a div with 5 elements that has 180px of

  • 0

I have a menu in a div with 5 elements that has 180px of width each element.
And I have a line under this, outside this div, that has an image that has to move depend on which element is hovered.

I do this: 5 element with Ids from “#fxmenu_1” to “#fxmenu_5.
i have to declare a variable for the number of the id hovered, and move #img with this rule in javascript (Jquery):

margin-left:180px (times #fxmenu_$i) from 1 to 5

I know allmost everything of the code, but the variable $i doesnt work at the end with my code, and i think there has to be something better to write. like a var=$”fxmenu_$i”

This is an Example of the code, there is more in php, but is all i can show you.

    <div id="pmenu">
<ul id="bmenul">
            <li>
                <a  class="brand" id="fxmenu1_" href="/"><img src="/logomenu.png" />LOGO</a>
            </li>
              <li>
                <a  id="fxmenu_2"  href="/team" title="team">The team</a>
              </li>
              <li>
                <a  id="fxmenu_3" href="/services" title="Servicios">Services</a>
              </li>
              <li>
                <a  id="fxmenu_4" href="/projects" title="Proyectos">Projects</a>
              </li>
              <li>
                <a  id="fxmenu_5" href="/contact" title="Contacto">Contact</a>
              </li>
        </ul>
<div id="bar">
    <img id="img" src="/efect.png" />
</div>
</div>

with the css is like this link http://jsfiddle.net/rzJMv/

This is with the jquery but i want to bring back to normal everything when i stop hovering, or if i hover other element to move to this new point.

$(document).ready(function(){
var id;
    $('#fxmenu_'+id+':not(.totalactive)').hover(function (){
        $('#img').animate({"marginTop": "-70px"},1000, function(){
            $('#img').animate({"marginLeft":+(180*id)+"px"},1000, function(){
                $('#img').animate({"marginTop": "-90px"},1000);
                });
        });
    });
});

http://jsfiddle.net/rzJMv/1/

  • 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-15T05:48:49+00:00Added an answer on June 15, 2026 at 5:48 am

    Would have to see more of your code to be sure but typically variables are used in javascript like so 'margin-left:'+(180*i)+'px'

    In the case of php, 'margin-left:'+(180*<?php echo $i; ?>)+'px'

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

Sidebar

Related Questions

I have a ul menu inside a wrapper div. each li element has float:left
I have a menu div which has a dark background. Inside it, I have
I have a menu bar and I want to create a div for each
I have a menu set up this way: <div id='top-navigation'> <ul> <li><a class='top-nav-button-unclicked' href='#'>SUBJECT</a></li>
I have the following jquery script: $(function(){ $('#top-menu').on('click', 'a.change-menu', function(e){ e.preventDefault() $(#menu-change-div).load($(this).attr(href)); }); });
So I have this code here: <table> <tr> <td width=200px valign=top> <div class=left_menu> <div
Hi I have a menu like this into my website: <div class=menu> <p align=left
I have a small menu div that i would like to keep in the
I have an element that serves as the banner on my website. This banner
I wonder if it's possible to have several div elements with different id that

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.