PDA

View Full Version : سوال: ایجاد انیمیشن



tooka123
سه شنبه 24 تیر 1393, 11:32 صبح
سلام اینو چه طور با جی کوئری پیاده سازی کنم و از کد css3 استفاده نکنم

<style>
#a{width:200px; height:200px; background-color:#00FFFF;}
#b{transform:scale(0);width:150px; height:150px; background-color:#00FF33; transition:all 1s;}
#a:hover #b{transform:scale(1);}
</style>



<div id="a">
<div id="b"></div>
</div>

Freedon_23
چهارشنبه 25 تیر 1393, 13:27 عصر
سلام
کد جی کوئری:
jQuery(document).ready(function() {
jQuery('div#a').css({'width':'300px', 'height':'300px', 'background': '#ccc'});
jQuery('div#b').css({'width':'0px', 'height':'0px', 'background': '#eee', 'position': 'absolute', 'top': '150px', 'left': '150px'});
jQuery('div#a').hover(function() {
jQuery('div#b').stop().animate({'width': '200px', 'height': '200px', 'left': '50px', 'top': '50px'}, 800);
}, function() {
jQuery('div#b').stop().animate({'width': '0px', 'height': '0px', 'top': '150px', 'left': '150px'}, 800);
});
});