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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:00:53+00:00 2026-05-27T11:00:53+00:00

I have a basic code like this (that duplicates several times): <h3 class=header>The header</h3>

  • 0

I have a basic code like this (that duplicates several times):

<h3 class="header">The header</h3>
<div class="content"> The content 
    <div class="showUp">hidden text</div>
</div>
<h3 class="header">The header2</h3>
<div class="content"> The content 2
    <div class="showUp">hidden text 2</div>
</div>

I want to create a roll over event that if I hover on the h3 or the div.content the .showup class will be shown. I only managed to create a rule for if I roll over the div.content class:

$('.content').mouseenter(function() {
    $(this).find(".showUp").animate({left: 0},300)
})
.mouseleave(function() {
    $(this).find(".showUp").animate({
        left: -200
    }, 500);
}); 

I know I can create an event for the header like this:

$('h3').mouseenter(function() {
    $(this)**.next()**.find(".showUp")...
});

but how do I bind these to elements to do the same thing using the the word “this” to one function

  • 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-27T11:00:54+00:00Added an answer on May 27, 2026 at 11:00 am

    This should do the trick.

    $('.content, h3')
        .mouseenter(function() {
            $(this).find('+ .content > .showUp').add($(this).find('> .showUp')).stop().animate({left: 0},300)});
        })
        .mouseleave(function() {
            $(this).find('+ .content > .showUp').add($(this).find('> .showUp')).stop().animate({left: -200},500)});
        });
    

    We attach an event listener to both the .content and the h3. Then in the event listener we search for an immediate sibling if it exists (+ .content > .showUp) or an immediate child (> .showUp) if it exists.

    So, in any case we’ll get the .showUp div to animate.

    I’ve also added the .stop() method to stop the animation before animating it (so it won’t have some quirk behavior if you hover the h3 and then the .content.

    I’ve made here a basic fiddle here, so you can see how it works.

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

Sidebar

Related Questions

I have html code that looks roughly like this: <div id=id1> <div id=id2> <p>some
This is a really basic question but... I have some code like this var
I have some C++ code that implements a basic Pixel class. Here's just a
I have some code that looks like this: <h3>Thursday Sep 10</h3> <ul>great stuff in
Suppose I have some code like this: class Visitor { public: Visitor(callBackFunction) {} void
I have a basic socket server that looks like this: IPEndPoint localEndPoint = new
Rather basic question here guys. Basically I have code like this: public SuperPanel() {
I have some basic PHP code: $raceramps56[short] = My Test Product; $leftMenu = '<div
I have some very basic semaphore code that works great on Linux, but cannot
I have something like the following in the header class MsgBase { public: unsigned

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.