[wd_asp elements=’search’ ratio=’100%’ id=1]

Change / Swap CSS by Jquery

14th July 2013

Jquery Misc

jquery icon

Change CSS properties, this has caused problems with some properties, and if so use the second method as shown under this next code.

$('#successMessage').css( {
left: '580px',
top: '250px',
width: 0,
height: 0
} );


If you have problems use this code, each property separately.

Stop displaying a div/element
$('.slidingDiv2').css({"display":"none"});

Change the width of a div/element
$(".slidingDiv2").css("width") == "95%");

Change paragraph text colour to green
$('p').css({"color":"green"});

Float all divs with class .left
$('div.left').css('float');

Change all elements with class .bg-red to have a red background
$('.bg-red').css({"background-color":"red"});

Change the image
$('.scrollbutton').css("background-image", "url(images/upscroll.png)");


$('.container-twelve').css('height', '377px');
$('.four.columns').css('height', '377px');
//or
document.getElementById('formID').style.left = "-109%";
document.getElementById('formID').style.border= "2px solid";

Change CSS Class



jQuery add / remove css class example

This is paragraph 1

This is paragraph 2

This is paragraph 3

This is paragraph 4