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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:55:20+00:00 2026-06-05T01:55:20+00:00

When the user hovers over the link with the class thumb the closest link

  • 0

When the user hovers over the link with the class "thumb" the closest link with the class "title" should have the class "media-link-hover" applied to it. How can this be done?

I tried closest() and also this but nothing seems to be working:

$('a.thumb').hover(function() {
    $(this)
        .prevAll('.block')
        .find('a.title')
        .addClass('media-link-hover');
}, function() {
    $(this)
        .prevAll('.block')
        .find('a.title')
        .removeClass('media-link-hover');
});

HTML:

<article class="block">
    <div class="inner-left">
        <a class="thumb" title="" href="">
            <img width="198" height="111" alt="" src="" />
            <span class="media-overlay">video</span>
        </a>
    </div>
    <div class="inner-right">
        <a class="title" title="" href="">Hello</a>
        <div class="description">
            <p>Hi there</p>
            <a class="teaser" href="">Hola</a>
        </div>
        <div class="media-stats">
            <span class="finder">Found by <strong>Me</strong> 1 month ago</span>
        </div>
    </div>
</article>
  • 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-05T01:55:21+00:00Added an answer on June 5, 2026 at 1:55 am

    Try with parents() and also you can reduce the code by using toggleClass().
    Demo http://jsfiddle.net/elclanrs/Ce8fu/

    $('a.thumb').hover(function() {
        $(this)
            .parents('.block')
            .find('a.title')
            .toggleClass('media-link-hover');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to remove a class once the user hovers over a link. Here
All, I have a horizontal menu bar. When the user hovers over each link
I have an image link. When the user hovers over the image, an info
I have a text link. When the user hovers over the text link, I
I have an image on my page and when the user hovers over it
Does anyone know how I can show a tooltip whenever a user hovers over
I have a nav that has subnavs. When the user hovers over the li's
I have a submit button that changes when the user hovers his mouse over
I have li boxes that make this jQuery call when an end user hovers
I am making div with image and text. User can hover on this div

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.