jquery - Hide a div near the button when button gets clicked -
ok, have div 100% height , 100% width , have button centered div. when user clicks button. want div collapse near button , hide. here code. , can see on js fiddle
http://jsfiddle.net/zxb4z/
$('button').click(function(){ $("div").animate({ left:'24%', top:'48%', opacity:'0', height:'0px', width:'0px' },'slow');});
use margin instead of position properties (top/left):
$('button').click(function(){ $("div").animate({ marginleft:'24%', margintop:'48%', opacity:'0', height:'0px', width:'0px' },'slow'); });
or apply position absolute on div:
div { position: absolute }
jquery html css css3
No comments:
Post a Comment