为什么 jQuery 对话框中显示的内容有点拥挤?
$(document).ready(function() {
$('.something').each(function() {
var $link = $(this);
$link.click(function() {
var $dialog = $('<div></div>')
.load($link.attr('href'))
.dialog({
autoOpen: false,
title: "Edit Book",
width: 'auto',
height: 'auto'
});
$dialog.dialog('open');
return false;
});
});
});
我有这段代码来显示由锚标记的 href 属性链接的内容。这非常有效!但唯一的问题是所有信息在 jQuery 对话框中显示时都有点拥挤。
通常,当不在对话框内时,页面看起来像这样,就像我想要的那样。 http://awesomescreenshot.com/0983qpcad
但是当在对话框内时,它看起来像这样,狭窄!
http://awesomescreenshot.com/09c3qpf1b
关于 jQuery 对话框中的选项,我是否缺少任何明显的内容?或者关于潜在修复的任何想法?预先感谢一百万:)
$(document).ready(function() {
$('.something').each(function() {
var $link = $(this);
$link.click(function() {
var $dialog = $('<div></div>')
.load($link.attr('href'))
.dialog({
autoOpen: false,
title: "Edit Book",
width: 'auto',
height: 'auto'
});
$dialog.dialog('open');
return false;
});
});
});
I have this code to show the contents which is linked by the href attribute of anchor tag. This works perfectly! But the only issue is all the information is sorta cramped up when displayed inside jQuery dialog box.
Usually when not inside a dialog box the page looks like this, the way i want it to.
http://awesomescreenshot.com/0983qpcad
But when inside a dialog box it looks like this, cramped up!
http://awesomescreenshot.com/09c3qpf1b
Is there anything obvious I am missing in regards to options in jQuery dialog box? Or any ideas on potential fixes?? Thanks a million in advance :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查您的 CSS 规则 - 它们似乎没有应用于对话框中的元素。
我的猜测是您的样式表包含在
$link.attr('href')
引用的目标页面中。但是,当您使用load
加载页面内容时,样式表和其他非内容元素将被丢弃。您需要在父页面中包含 CSS。Check your CSS rules - it appears they aren't being applied to elements within the dialog.
My guess is that your stylesheet is included in the target page referenced by
$link.attr('href')
. However, when you useload
to load the page contents, stylesheets and other non-content elements are discarded. You need to include the CSS in the parent page.