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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:49:36+00:00 2026-05-11T02:49:36+00:00

I have an element in my document that has a background color and image

  • 0

I have an element in my document that has a background color and image set through a regular CSS rule.

When a certain event happens, I want to animate that item, highlighting it (I’m using Scriptaculous, but this question applies to any framework that’ll do the same).

new Effect.Highlight(elHighlight, { startcolor: '#ffff99', endcolor: '#ffffff', afterFinish: fnEndOfFadeOut }); 

The problem i’m facing is that after the animation is done, the element is left with the following style (according to FireBug):

element.style {   background-color:transparent;   background-image:none; } 

Which overrides the CSS rule, since it’s set at the element level, so I’m losing the background that the item used to have…

What I’m trying to do is, in the callback function I’m running after the animation is done, set the style properties to a value that’ll make them "go away".

var fnEndOfFadeOut = function() {   elHighlight.style.backgroundColor = "xxxxx";   elHighlight.style.backgroundImage = "xxxxx"; } 

What I’m trying to figure out is what to put in "xxxx" (or how to do the same thing in a different way).
I tried ‘auto’, ‘inherit’, and ” (blank string), and neither worked (I didn’t really expect them to work, but I’m clueless here).

I also tried elHighlight.style = ""; which, expectably, threw an exception.

What can I do to overcome this?
I know I can put a span inside the element that I’m highlighting and highlight that span instead, but I’m hoping I’ll be able to avoid the extra useless markup.

  • 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. 2026-05-11T02:49:37+00:00Added an answer on May 11, 2026 at 2:49 am

    Chances are you’re not setting the style on the correct element. It’s probably being set somewhere up the line in a parent node.

    elHighlight.style.backgroundColor = ''; elHighlight.style.backgroundImage = ''; 

    You can also remove all the default styling by calling:

    elHighlight.style.cssText = ''; 

    In any case, you’ll still have to do this on the specific element that is setting these properties, which means you may need to do a recursion on parentNode until you find it.

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

Sidebar

Ask A Question

Stats

  • Questions 68k
  • Answers 68k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer The left self-join was a good instinct, but I don't… May 11, 2026 at 12:23 pm
  • added an answer I, too, encountered that problem this evening. After some searching… May 11, 2026 at 12:23 pm
  • added an answer Quick fix: You can use the flag /property:OutDir=bin\x86\Release You would… May 11, 2026 at 12:23 pm

Related Questions

I'm trying to use XPath to find all elements that have an element in
I am trying to have an element fade in, then in 5000 ms fade
I have a swing client that renders HTML through the use of the JEditorPane
I'm trying to design an XML document structure for my application. I want to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.