Skip to content Skip to sidebar Skip to footer

Jquery Duration For Toggleclass Issue

I'm trying to change style class of div element during 1 second with some effect. This is my code. When I execute this example style switches immediately without effects and timeou

Solution 1:

toggleClass do not animate the style attributes you have to use animate method of JQuery.

$("#divka").animate({
borderWidth: "1px",
borderColor: "#000",
borderStyle: "solid",
backgroundColor:"#eee",
width:"200px",
height:"400px",
}, 500);

Solution 2:

toggleClass has nothing to do with "slow"-like params - this is valid for for methods, using animations.

Check the docs.

Solution 3:

The toggleClass function doesn't work that way. The behaviour you're looking for is accomplished with the jQuery UI switchClass function.

Solution 4:

You could use addClass() or switchClass() which is part odf jquery UI:

$("#divka").addClass("a1",500);

Post a Comment for "Jquery Duration For Toggleclass Issue"