[英]clicking a link in jqueryui dialog
I'm using jquery dialog for displaying html files in a modal dialog: 我正在使用jquery对话框在模式对话框中显示html文件:
main site calling test.html: 主站点调用test.html:
<body>
<div id="layer" style="display: none;">
</div>
</body>
<script type="text/javascript">
$("#layer").dialog({
dialogClass: 'noTitleStuff',
autoOpen: false,
position : ['center',20],
/*draggable: false, */
resizable : true,
modal : true,
show : 'fade',
hide : /*'drop'*/'fade',
width: 'auto',
heigth: 'auto',
open: function() {
$(".ui-dialog-titlebar").removeClass('ui-widget-header');
},
});
$( function() {
$("#layer").load('test.php', function() {
$("#layer").dialog("open");
});
});
</script>
This works fine and the content of test.php is displayed well. 这可以正常工作,并且test.php的内容可以很好地显示。 But when i'm clicking a link in test.php the link is opened in the whole browser windows. 但是,当我单击test.php中的链接时,该链接会在整个浏览器窗口中打开。 How i can display the new site in the dialog too? 我如何也可以在对话框中显示新站点?
Thanks for your help 谢谢你的帮助
Load the content of new url to the dialog. 将新网址的内容加载到对话框中。
$(function(){
$(document).on("click", ".yourLinkCssClassName", function (e) {
e.preventDefault();
$.get($(this).attr("href"), function (data) {
$("#layer").html(data);
});
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.