0
我试图让对话框从屏幕的一侧飞入,比方说,顶端。我能够用一些肮脏的黑客来做到这一点,但是,它的表现非常不理想。这里是我的代码:jQuery对话框飞入
$(':button').click(function() {
$('<div class="myDialog" title="Test"></div>').dialog({
'position' : 'top'
}).dialog('widget').css({
'position' : 'fixed',
'top' : '0',
'height' : '0'
}).animate({
'height' : '200'
}, 1000, function() {
$(this).animate({
'top' : '40%'
}, 1000);
});
});
在jQuery UI中没有任何处理这种方式我希望的效果。有没有一种方法可以提高其性能,因此它很顺利?如果可能,我想避免使用插件。
谢谢你的时间。
编辑:好吧,这里是我偶然来到了,随着smellofgreen的帮助:
$(':button').click(function() {
$('<div class="myDialog" title="Test"></div>').dialog({
'position' : 'top'
}).dialog('widget').css({
'position' : 'fixed',
'top' : $(document).height()+200, //Here was the crown-jewel
'display' : 'none'
}).slideDown('slow', function() { //Thanks to smellofgreen
$(this).animate({
'top' : '40%'
});
});
});
啊....让我看看,看到我得到:) – 2011-05-26 20:50:08
如此接近。表现要好得多,但滑下来和下移之间仍然存在一点点暂停。所以,这看起来不自然。有没有办法缩小这个差距? – 2011-05-26 20:54:46
哇!我只是做了一个完全有效的改变!我将你的想法用于“幻灯片”技术。我只是需要我滑下来。我会在上面发布我的代码。为你+1! – 2011-05-26 21:05:56