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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:18:20+00:00 2026-06-02T16:18:20+00:00

When hover the link I am trying to change the background of previous div,

  • 0

When hover the link I am trying to change the background of previous div, But here it is not working here is code Jsfiddle this is my script

$('div a.link').hover(function(){

var icon = $(this).prevAll('div.icon').first();          
          icon.css({'background':'url(http://www.rangde.org/images/icons/circle_grey_hover.jpg) no-repeat', 'color':'#fff','cursor':'pointer'});

 });          

my html

<div class="icon">1</div>
<div><a href="#" class="link">First article</a></div>
<div class="clearfloat"></div>
<div class="icon">2</div>
<div><a href="#" class="link">Second article</a></div>
<div class="clearfloat"></div>
<div class="icon">3</div>
<div><a href="#" class="link">Third article</a></div>

my css

.icon{background: url(http://www.rangde.org/images/icons/circle_grey.jpg) no-repeat;
width: 92px;
height: 97px;
padding: 35px 0px 0px 45px;
font-size: 14pt;
color: black;
font-weight: 600;
width: 32%;float:left;}
.link{width:60%;float:left;color:#048ccc;font-weight:600;padding-top:30px;}
.clearfloat{clear:both;}
​
  • 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-02T16:18:22+00:00Added an answer on June 2, 2026 at 4:18 pm
     $('div a.link').hover(function(){
         var icon = $(this).parent().prev();          
         icon.css({'background':'url(http://www.rangde.org/images/icons/circle_grey_hover.jpg) no-repeat', 'color':'#fff','cursor':'pointer'});
     }, function() {
         var icon = $(this).parent().prev().css({'background':'none'});
     });           
    
    ​
    

    http://jsfiddle.net/FEdk9/9/

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

Sidebar

Related Questions

I have this code which I am trying to change the ID of on.hover.
Here is the link to the jsfiddle: http://jsfiddle.net/d3xMZ/ when I hover, it does exactly
I want to change the link-style for some of my links, like this: a:hover
I am trying to change the colors of a link using css but for
I'm using this tickertype jquery plugin: http://www.hungry-media.com/code/jQuery/tickerType/ And I'm trying to attach a hover
Good morning, I'm trying to change the background color on a link when the
I'm trying to make a div's background color change on mouse over . the
Im trying to take a link either when clicked or hover over be able
I'm using this for my link-hover-transition-effect: -webkit-transition: color 250ms ease-in 0; -moz-transition: color 250ms
How do I unbind hover in jQuery? This does not work: $(this).unbind('hover');

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.