Reputation:
I know about the JQuery:
.animate()
Though I was wondering how to incorporate css into it?
Any ideas?
Upvotes: 0
Views: 47
Reputation: 113517
From documentation:
.animate( properties [, duration ] [, easing ] [, complete ] )
Description: Perform a custom animation of a set of CSS properties.
$("#block").animate({width: "70%",}, 1500 );
Object with CSS properties ----^ ^--- Milliseconds
<!DOCTYPE html>
<html>
<head>
<style>
div {
background-color:#bca;
width:100px;
border:1px solid green;
}
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
<button id="go">» Run</button>
<div id="block">Hello!</div>
<script>
/* Using multiple unit types within one animation. */
$("#go").click(function(){
$("#block").animate({
width: "70%",
opacity: 0.4,
marginLeft: "0.6in",
fontSize: "3em",
borderWidth: "10px"
}, 1500 );
});
</script>
</body>
</html>
More information on documentation pages.
Upvotes: 0
Reputation: 1
use .animate({any css you want to change}) , for ex
.animate({left:0px})...
this will animate the element to the left, you can also give a time for the transition to take place, like
.animate({left:0px},200)
where 200 specifies 200 mili seconds
Upvotes: 0