admin管理员组文章数量:1405748
I want to make a link on an HTML page, so that when the user clicks on it, a "pop-up" with a certain image appears. Now, the main thing is that I don't want this pop-up to be a new tab/window in the browser. I want it to be part of the page itself. It would be great if the pop-up can be moved around the page just like a separate window.
Is there a JavaScript/JQuery library that could achieve this?
I want to make a link on an HTML page, so that when the user clicks on it, a "pop-up" with a certain image appears. Now, the main thing is that I don't want this pop-up to be a new tab/window in the browser. I want it to be part of the page itself. It would be great if the pop-up can be moved around the page just like a separate window.
Is there a JavaScript/JQuery library that could achieve this?
Share asked Sep 6, 2013 at 2:06 Mika H.Mika H. 4,36913 gold badges47 silver badges64 bronze badges3 Answers
Reset to default 2This should do it: http://jsfiddle/55DBx/1/
Utilizes jQuery and jQuery UI. Good luck!
jQuery:
$( "#dialog" ).dialog({ autoOpen: false });
$( "#btnExample" ).click(function() {
$( "#dialog" ).dialog( "open" );
});
Html:
<button id="btnExample">open the dialog</button>
<div id="dialog" title="Dialog Title">I'm a dialog</div>
The jQueryUI Dialog is exactly what you are looking for.
You can define your popup "window" in a DIV, like this:
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
And then you can show the dialog, via jQuery, when the user clicks a link, like this:
<script>
$("#YourLink").click(function(e) {
e.preventDefault();
$("#dialog").dialog();
return false;
});
</script>
You probably want to take a look at Bootstrap modals: http://getbootstrap./javascript/#modals
or jquery ui dialog: http://jqueryui./dialog/
本文标签: Popup on the same page using JavaScriptJQueryStack Overflow
版权声明:本文标题:Pop-up on the same page using JavaScriptJQuery - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744927968a2632720.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论