Solved

css style not changing. why?

Posted on 2014-04-01
1
395 Views
Last Modified: 2014-04-21
Hi;

I have the following css.

.aui-header .aui-nav .aui-buttons .aui-button-primary,
.aui-header .aui-nav .aui-buttons .aui-button-primary:link,
.aui-header .aui-nav .aui-buttons .aui-button-primary:visited {
    background: #336ea9;
    background-image: -moz-linear-gradient(top, #3b7fc4, #336ea9);
    background-image: -ms-linear-gradient(top,  #3b7fc4, #336ea9);
    background-image: -webkit-linear-gradient(top,  #3b7fc4, #336ea9);
    background-image: -o-linear-gradient(top,  #3b7fc4, #336ea9);
    background-image: linear-gradient(top,  #3b7fc4, #336ea9);
    height: 28px;
    border: 0;
    box-shadow: rgba(255, 255, 255, 0.1) 0 1px 0 0 inset, rgba(0, 0, 0, 0.2) 0 1px 1px 0;
    color: #fff;    
    text-shadow: 0 1px 0 #295989;
}

Open in new window


and following jquery

$('.aui-buttons').css({ 'background-color': '#FF6633', 'background-image': '-webkit-gradient(linear, left top, left bottom, from(#FF6633), to(#FF6633))',
'background-image': '-webkit-linear-gradient(top, #FF6633, #FF6633)',
'background-image': '-moz-linear-gradient(top, #FF6633, #FF6633)',
'background-image': '-ms-linear-gradient(top, #FF6633, #FF6633)',
'background-image': '-o-linear-gradient(top, #4ba614, #FF6633)',
'background-image': 'linear-gradient(to bottom, #FF6633, #FF6633)',
'background-color': '#FF6633',
'background': '#FF6633'
});

Open in new window


and background doesn't become from:
'background': '#336ea9'
to:
'background': '#FF6633'

Why?

Regards.
0
Comment
Question by:jazzIIIlove
1 Comment
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 39969719
It's because your CSS is styling the .aui-button-primary element and your jQuery is applying the style to it's parent (.aui-buttons). You need to apply the jQuery CSS to the same child:

$('.aui-buttons .aui-button-primary').css({
   ...
}

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question