سلام به همه!
یه سوال!
چطور می تونم از animate() مثل toggle استفاده کنم؟
میخوام با هر بار کلیک روی دکمه هام div هایی که مشخص کردم نشون بده
.box{ width:200px; height:600px; position:relative; border:1px solid #000000; background:#272626; overflow:hidden; } .child{ box-sizing:border-box; width:200px; height:600px; position:absolute; background:#808080; margin-left: 205px; }
/////////////////////////////////////////////////////
<button type="button" id="one">salam!</button> <button type="button" id="two">bye!</button> <div class="box"> <div class="child" id="childone"><span>salaaaaaaaam</span></div> <div class="child" id="childtwo"><span>babyyyyyyyyyyye</span></div> </div>
///////////////////////////////////////////////////////////////////
$('#two').click(function () { $('#childtwo').animate({ marginLeft: "0px" }, 500); }); $('#one').click(function () { $('#childone').animate({ marginLeft: "0px" }, 500); });
$('.login').toggle( function(){ $('#one').animate({ height: "150", padding:"20px 0", backgroundColor:'#000000', opacity:.8 }, 500); $('#otherdiv').animate({ //otherdiv properties here }, 500); }, function(){ $('#one').animate({ height: "0", padding:"0px 0", opacity:.2 }, 500); $('#otherdiv').animate({ //otherdiv properties here }, 500); });
توضیحات تکمیل تر اینجا
هیچ کاربری تا کنون از این پست تشکر نکرده است
با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)