0

啊!到目前为止,我的网站(正在进行中)在我迄今为止测试过的所有浏览器(firefox、safari、chrome 和 IE8)中都运行良好,但在 IE7 中却没有(我不知道 IE6 或其他浏览器)......我'm not positive但我认为这个问题与在我的jQuery中使用prepend()有关。主要问题是主菜单(应该显示在徽标左侧的蓝色水平栏中)以及右上角的搜索框,两者都使用前置添加。IE7 中还有其他问题,所以我不确定我是否认为它来自 jQuery,或者在我当前的 CSS 混乱中是否有错字!

这是我用于主菜单的脚本,它在 IE7 中不起作用,但在其他浏览器中起作用 - 有人在这里看到问题吗?

<script type="text/javascript">
<!--
$(function() {

/* ************************************** */
/* main menu */
/* ************************************** */
$("#bannerAreaWrapper").prepend("<div id='MainMenu'><a id='neutralsBtn' class='MainMenuModule' href='/neutrals-overview/'>Neutrals</a> <span class='bullet'>•&lt;/span> <a id='practicesBtn' class='MainMenuModule' href='/practices/'>Practices</a> <span class='bullet'>•&lt;/span> <a id='locationsBtn' class='MainMenuModule' href='/locations/'>Locations</a></div>");

});
-->
</script>

这是该网站的链接:http : //www.agencydr.squarespace.com 非常感谢您的帮助!

4

2 回答 2

3

IE7 在您的站点中发现两个 javascript 错误:

Expected identifier, string or number line 139
$('#LocationsMapWrapper').hover(function() {
   $('#LocationsMapWrapper #MapImage').animate({
      width: 600,
      height: 375,
      marginLeft: 550,
      marginTop: -20,                <---- remove comma
   }, "slow", "easeOutQuad");
 }

 'document.getElementById(...)' is null or not an object line 355
Shadowbox.setup(document.getElementById('Map').getElementsByTagName('area'), {width : 450, height : 400});
于 2010-09-16T21:39:54.747 回答
1

当我通过 IE7 上的开发工具栏脚本控制台运行它时,您的 prepend 函数工作正常,尽管它在加载时不起作用。您在 IE8 上收到一个 js 错误,在 IE7 上收到两个错误。IE7 上的附加功能与此功能有关:

$('#LocationsMapWrapper').hover(function() {
   $('#LocationsMapWrapper #MapImage').animate({
      width: 600,
      height: 375,
      marginLeft: 550,
      marginTop: -20,
   }, "slow", "easeOutQuad");
 }

第 139 行

尝试删除它并查看导航是否在页面加载时按预期工作

编辑

轰,明白了。

尝试删除'marginTop:-20'之后的逗号,最后一个元素不应该有这个,认为它会影响所有旧浏览器

于 2010-09-16T21:37:45.983 回答