mik*_*ike 1 jquery modal-dialog popup jquery-animate
我想知道在显示之前不存在的div时最佳实践是什么,然后在使用Jquery时将其删除.像一个模式弹出框,如灯箱或排序......
我的页面上有一个弹出式购物车,它的工作方式很好.最初我让购物车淡出为0.但如果你这样做,下面的html是不可点击的...所以现在我已经将购物车div向右移动了很远并且褪色了.然后当您单击"购物车"按钮时,我将所有样式重新设置为正常状态.我想知道是否有更清洁的方式.说只是为了消除一个div,然后禁用div所以下面的html是可点击的...因此你不必用一堆css移动弹出div.
继承我目前的代码:
document.getElementById("shopping-container").style.position="absolute";
document.getElementById("shopping-container").style.left="2000px";
$(".open").click(function() {
$("#shopping-container").stop().animate({"opacity": "1"}, "fast", function(){
document.getElementById("shopping-container").style.position="relative";
document.getElementById("shopping-container").style.top="150px";
});
});
$(".close").click(function() {
$("#shopping-container").stop().animate({"opacity": "0"}, "fast", function(){
document.getElementById("shopping-container").style.position="absolute";
document.getElementById("shopping-container").style.left="2000px";
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
528 次 |
| 最近记录: |