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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:02:30+00:00 2026-05-22T18:02:30+00:00

I made an easy div hover control, show and hidden introduce words with jquery.

  • 0

I made an easy div hover control, show and hidden introduce words with jquery.

I have already ask a question in stackoverflow.com

@Steve Perks and @patorjk answered me. Thanks both of them.

But now, I still have some more questions.

  1. the index problem in IE. how to make div.hover on the top level?

  2. If I add some hyper link in the div.hover, how to modify js code, so that only mouse out both div.hover and div.title, div.hover would hidden (I need click the link)

Thanks a lot.


I updated my code here http://jsfiddle.net/3jGdm/1/

HTML

<div id="body">
    <div id="main">
        <div class="box">
            <div class="title">1</div>
            <div class="hover">this is number 1, when you hover to the box content, show <a href="">something</a> here.</div>
            <p>Box 1</p>
        </div>
        <div class="box">
            <div class="title">2</div>
            <div class="hover">this is number 1, when you hover to the box content, show <a href="">something</a> here.</div>
            <p>Box 2</p>
        </div>
        <div class="box">
            <div class="title">3</div>
            <div class="hover">this is number 1, when you hover to the box content, show <a href="">something</a> here.</div>
            <p>Box 3</p>
        </div>
        <div class="box">
            <div class="title">4</div>
            <div class="hover">this is number 1, when you hover to the box content, show <a href="">something</a> here.</div>
            <p>Box 4</p>
        </div>
        <div class="box">
            <div class="title">5</div>
            <div class="hover">this is number 1, when you hover to the box content, show <a href="">something</a> here.</div>
            <p>Box 5</p>
        </div>
        <div class="box">
            <div class="title">6</div>
            <div class="hover">this is number 1, when you hover to the box content, show <a href="">something</a> here.</div>
            <p>Box 6</p>
        </div>
        <div class="box">
            <div class="title">7</div>
            <div class="hover">this is number 1, when you hover to the box content, show <a href="">something</a> here.</div>
            <p>Box 7</p>
        </div>
        <div class="box">
            <div class="title">8</div>
            <div class="hover">this is number 1, when you hover to the box content, show <a href="">something</a> here.</div>
            <p>Box 8</p>
        </div>
    </div>
</div>

CSS

*{margin:0;padding:0;border:0;}
#body{width:100%;height:100%;background-color:#fff;}
#main{width:800px;height:400px;margin:0 auto;background-color:#999;}
.box{float:left;width:180px;height:150px;margin:9px;border:1px solid #666;display:inline-block;position:relative;}
.title{font-size:32px;line-height:150px;text-align:center;}
.hover{display:none;position:absolute;width:300px;background-color:#9C9;border:1px solid #666;z-index:10;font-size: 16px;}
.oy .hover{right:0;}
p{text-align:center;background-color:#333;}

jQuery

jQuery(document).ready(function(){
    $('.box:nth-child(4n+4)').addClass('oy');
    $(".title").mouseover(
    function () {
      $(this).parent('.box').children(".hover").show();
    }), 
    $(".title").mouseout(
    function () {
      $(this).parent('.box').children(".hover").hide();
    }
);
});
  • 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-22T18:02:31+00:00Added an answer on May 22, 2026 at 6:02 pm

    1) It seems to be working alright, but this code would guarantee it’s on top:

    $('div.hover').css('z-index', '1000');
    

    2) You would just add a mouseover and mouseout function for the hover divs as well:

    $('div.hover').mouseover(
        function(){
            $(this).show();
        }
    );
    $('div.hover').mouseout(
        function(){
            $(this).hide();
        }
    );
    

    http://jsfiddle.net/3jGdm/6/

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

Sidebar

Related Questions

No related questions found

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.