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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:43:43+00:00 2026-05-23T00:43:43+00:00

I am trying to have an element rather like the Twitter tweets area. The

  • 0

I am trying to have an element rather like the Twitter tweets area. The DIV should be a different colour on mouseover with a new position for the background image.

Then when the user clicks the background image position should move again and the background colour should change only when the user is not on hover. I tried this but it will not work.

JS —

function reviews(id) {
    $('#reviews .review').removeClass('ractive');
    $(id).addClass('ractive');
}

CSS —

#reviews .review {
    font-family:"Lucida Grande", Arial, sans-serif;
    display:block;
    width:599px;
    padding-right:30px;
    background:url(images/ui/arrows.png) -60px -60px no-repeat;
}
#reviews .review:hover {
    background-position:605px 50px; 
    background-color:#E6F5F5;
    }
#reviews .review .ractive {
    background-color:#E2E2E2;
    background-position:605px -100px; 
}
#reviews .review .ractive:hover {
    background-color:#E6F5F5;
    background-position:605px -100px; 
}

HTML

<div class="review" onclick="reviews(this);">Blah Blah Blah Blah</div>

Any ideas what is wrong. The new class does not seam to be applied to the element.

Marvellous

  • 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-23T00:43:44+00:00Added an answer on May 23, 2026 at 12:43 am
    $(id).addClass('ractive');
    

    is not getting a proper selector. From your markup you should be doing.

    $('.review').click(function() {
        $(this).addClass('ractive');
    });
    

    You should then REMOVE onclick="reviews(this); from your markup. If you are using jquery to apply classes, stick with that approach overall. Don’t mix obtrusive and unobtrusive javascript. The code posted above will add the ractive class to only the link you have clicked.

    Also, change your css from #reviews .review .ractive to just #reviews .ractive. The class you have is looking for an element inside review with the class ractive, you don’t need that as the class is on the same element

    #reviews .review:hover {
        background-position:605px 50px; 
        background-color:#E6F5F5;
        }
    #reviews .ractive {
        background-color:#E2E2E2;
        background-position:605px -100px; 
    }
    #reviews .ractive:hover {
        background-color:#E6F5F5;
        background-position:605px -100px; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an element like this: <div id=foo_<?php echo $id;?> class=hidden></div> I'm trying if
I have a DIV element with a background image and I am trying to
I'm trying to have this block element to be horizontally aligned in the middle
I am trying to see if an element have a specific CSS attribute. I
I'm trying to select an element from my webpage... I have inserted a control
I am trying to middle align an element, But I have bumped into this
I am trying to return a computed element with a computed attribute. I have
Here is what I am trying to do: I have a <h1> element, a
What I am trying to do is position a list element over an inline
I am trying to draw a figure something like this: I need to have

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.