user962408
user962408

Reputation: 147

How to use JQuery to change the same type of CSS

How to change the same type CSS??

eg.

background: -webkit-linear-gradient(left, #1e5799 0%,#7db9e8 100%);
background: -moz-linear-gradient(left, #1e5799 0%, #7db9e8 100%); 

Will .eq(0) work on this case??

$('.block').css("background.eq(0)", '-webkit-linear-gradient(left, #1e5799 50%,#7db9e8 100%)' );
$('.block').css("background.eq(1)", '-moz-linear-gradient(left, #1e5799 50%, #7db9e8 100%)' );

Upvotes: 1

Views: 68

Answers (1)

ShankarSangoli
ShankarSangoli

Reputation: 69905

It will not work. Try this based on browser check.

if($.browser.webkit){
  $('.block').css("background", '-webkit-linear-gradient(left, #1e5799 50%,#7db9e8 100%)' );
}

if($.browser.mozilla){
  $('.block').css("background", '-moz-linear-gradient(left, #1e5799 50%, #7db9e8 100%)' );
}

Upvotes: 2

Related Questions