需要用jquery对话框打开&传递效果关闭
我正在寻找具有传输效果的 jquery 对话框打开/关闭。我从这个网站找到了一个并且它正在工作。但它没有按照我想要的方式工作。
这是代码
JQuery snippet
---------------
$("#PMinfo").dialog({
autoOpen: true,
height: 250,
width: 600,
modal: false,
draggable: false,
resizable: false,
close: function() {
var $this = $(this);
$this
.dialog("widget")
.effect("transfer", {
to: "#smpb_info_btn",
className: "ui-effects-transfer"
}, 500, function() {
$this.remove();
});
}
});
CSS .ui-effects-transfer { border: 2px dotted gray; }
---
HTML
----
<div id="PMinfo">Hello</div>
<button id="smpb_info_btn">Info</button>
我希望对话框不应该自动打开,而是当用户单击信息按钮时,它应该以传输效果打开,就像它出现在页面中心的按钮和位置一样。当用户关闭时,它会关闭并移动并消失到信息按钮。
所以请指导我需要改变什么才能以我的方式工作。谢谢
i was looking for jquery dialog box open/close with transfer effect. i found one from this site and it is working. but it is not working the way i want.
here is code
JQuery snippet
---------------
$("#PMinfo").dialog({
autoOpen: true,
height: 250,
width: 600,
modal: false,
draggable: false,
resizable: false,
close: function() {
var $this = $(this);
$this
.dialog("widget")
.effect("transfer", {
to: "#smpb_info_btn",
className: "ui-effects-transfer"
}, 500, function() {
$this.remove();
});
}
});
CSS .ui-effects-transfer { border: 2px dotted gray; }
---
HTML
----
<div id="PMinfo">Hello</div>
<button id="smpb_info_btn">Info</button>
i want the dialog should not open automatically rather when user click on info button then it should open with transfer effect as if it appear from button and position at center of the page. when user close then it close and move and disappear to info button.
so please guide me what i need to change to work it in my way. thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以为此使用 jquery animate 功能。
你必须提供顶部和顶部按钮的左侧作为动画函数的输入,以便放大按钮。当用户单击按钮时,可以完成相反的操作。
You could use the jquery animate feature for this.
you have to provide the top & the left of the button as the input to the animate function so that it zooms into the button. The reverse could be done when user clicks on the button.
我找到了一种让它发挥作用的方法,但它看起来像是一个丑陋的黑客。我很高兴看到比这更优雅的解决方案:
I found a way to make it work, however it rather seems like an ugly hack. I'd be glad to see a more elegant solution than this:
我猜你看到的问题是转移效应的起点。您的解决方案针对 IE 修复了该问题,但不适用于 Firefox。我已经为你总结了重要的部分。我希望有人发布一些能够更好地跨越浏览器边界的内容。
I'm guessing the problem you are seeing is the starting point of the transfer effect. Your solution fixes it for IE but not for Firefox. I've boiled the close down to the important part for you. I hope someone posts something that crosses the browser boundary better.