Пример:
Загрузить новый оффициальный "jQuery Color Animation" плагин и установить цветовую анимацию, как только плагин будет полностью загружен.
"jQuery"
jQuery.getScript("http://dev.jquery.com/view/trunk/plugins/color/jquery.color.js", function(){ $("#go").click(function(){ $(".block").animate( { backgroundColor: 'pink' }, 1000) .animate( { backgroundColor: 'blue' }, 1000); }); });
"HTML"
<button id="go"> Run</button> <div class="block"></div>
"CSS"
.block {
background-color: blue;
width: 150px;
height: 70px;
margin: 10px;
}
"Живой пример jQuery"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="http://slyweb.ru/css/jqueryiframe.css"
rel="stylesheet" type="text/css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
jQuery.getScript("http://dev.jquery.com/view/trunk/plugins/color/jquery.color.js", function(){
$("#go").click(function(){
$(".block").animate( { backgroundColor: 'pink' }, 1000)
.animate( { backgroundColor: 'blue' }, 1000);
});
});
});
</script>
</head>
<body class="iframe">
<button id="go"> Run</button>
<div class="block"></div>
</body>
</html>
<style>
.block {
background-color: blue;
width: 150px;
height: 70px;
margin: 10px;
}
</style>
Пример:
Загрузить test.js JavaScript файл и выполнить его.
Пример: