我想在页面加载时自动使用jQuery动画徽标。首先,图像需要缩小,然后放大,它变成了一个不同的图像。我如何用jQuery做到这一点?请帮帮我。下面是我的代码:
$(document).ready(function() {
$( "#minion" ).animate({
height: '50%',
width: '50%'
}, 3000,
function() {
$( "#minion" ).animate({
opacity: 0.5
}, 1000,
function() {
$("#logo").html( $(".hiddendiv img, .hiddendiv div").clone() );
});
});
});
.hiddendiv {
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="logo">
<img id="minion" src="images/logo.png" />
</div>
<div class="hiddendiv">
<img src='images/logo-small.png' />
<div>complete transformation</div>
</div>
谢谢
您可以这样做jsfiddle.net/d7UjD/9
<img id="zoomimg" src="http://www.google.com/images/srpr/logo3w.png"
width="144" height="48" border="0" />
$(document).ready(function(){
$('#zoomimg').css("cursor","pointer");
$('#zoomimg').animate({width: "50%", height: "50%"}, 'slow');
setTimeout(function() {
$('#zoomimg').animate({width: "28%"}, 'slow');
}, 1000 );
});