有问题的网站:http: //homecapture.ca/testset/index.html
场景:我有一个从无序列表生成的选项卡式菜单,当单击菜单项时,它会显示一个 iframe,该 iframe 链接到包含图片库的页面。我正在为选项卡式菜单使用 jQuery UI 选项卡,我链接到的画廊是 jQuery Galleria 页面,由 Jalbum 自动生成。
问题:Galleria 插件只能在 Chrome 5.0 的包含 iframe 的内部正常工作,在 IE8 中的行为不一致(似乎在我的本地副本中工作,但无法在线正确加载),并且没有正确加载火狐 3.6.3。Galleria 页面不显示缩略图区域和第一个大图像,而是仅显示第一个缩略图,然后单击它链接到的图像,但是如果您右键单击并返回,则 iframe 内容显示为正确呈现的 Galleria 页面。
所以代码看起来像:
<head>
<title>homecapture.ca</title>
<!-- link to jquery-ui-1.8.1.custom.css rel="stylesheet" -->
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.1.custom.min.js"></script>
<script type="text/javascript">
$(function(){
// Tabs
$('#tabs').tabs();
//hover states on the static widgets
$('#dialog_link, ul#icons li').hover(
function() { $(this).addClass('ui-state-hover'); },
function() { $(this).removeClass('ui-state-hover'); }
);
});
</script>
<!--there are some more css in here for now-->
</head>
<body>
<div id="tabs" style="margin:0 auto;clear:both;">
<ul>
<li><a href="#tabs-1"> 1 </a></li>
<li><a href="#tabs-2"> 2 </a></li>
<li><a href="#tabs-3"> 3 </a></li>
<li><a href="#tabs-4"> 4 </a></li>
</ul>
<div id="tabs-1">
<p> Information </p>
</div>
<!--- this tab loads a flash application and works fine -->
<div id="tabs-2">
<iframe src="tour/index.html" width="960" height="700"></iframe></div>
<!-- image gallery tab-->
<iframe id="tabs-3" src="gallery_jd/index.html" width="960" height="700"></iframe>
<!-- drawings tab -->
<iframe id="tabs-4" src="gallery/index.html" width="960" height="700"></iframe>
</div> <!-- end tabbed content-->
</body>
Jalbum 在 iframed 页面的 <head> 中生成脚本,除了链接到 jQuery 和 Galleria 插件。所有这些似乎都在负责图库导航,我已将其重新定位到页面的 <body> 中,以使其在父页面脚本之后加载,并与图库内容一起加载。
编辑:浏览了更多,似乎只是将脚本从标题重新定位到正文的末尾并不一定会导致整个 iframe 在代码之前被加载(这似乎是问题所在)
在这一点上,我不确定我还能做些什么来解决问题,而不是在所有或部分库中挖掘并插入 .js 文件(如果没有一些指针,我没有足够的知识去做)。有没有人处理过类似的问题?我在这里看到了一些使用 jQuery 从父页面操作 iframe 内容的解决方案,这是我应该研究的吗?
您好,首先 - 我对 javascript 并不完全陌生,但并不像我使用 html 和 css 那样精通它,而且对 jQuery 尤其陌生......所以如果这个问题看起来很简单或很明显,请原谅我,但是经过几天的谷歌我仍然没有解决问题......使用jQuery 1.4.2.min,jQuery-ui-1.8.1 ....