jQuery可以在除IE7之外的所有浏览器中使用 [英] jquery prepend working in all borwsers except IE7

查看:109
本文介绍了jQuery可以在除IE7之外的所有浏览器中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

糟糕!到目前为止,我的网站(正在进行中)在我测试过的所有浏览器(firefox,safari,chrome和IE8)中都运行良好,但在IE7(我不了解IE6或其他浏览器)中却无法正常工作. '不是积极的,但我认为问题与我的jQuery中使用prepend()有关.主要问题是主菜单(应显示在徽标左侧的蓝色水平栏中)以及右上角的搜索框,两者均使用前缀添加.整个IE7中还有其他问题,因此我不确定我是否正在按轨认为它是来自jQuery,还是我当前的CSS混乱中是否有错字!

Arrg! My site (in progress) is working great so far in all browsers I've tested to-date (firefox, safari, chrome, and IE8) but not in IE7 (I dont know about IE6 or other browsers) .... I'm not positive but i think the issue has to do with the use of prepend() in my jQuery. the main issues are the main menu (should show up in the blue horizontal bar to the left of the logo) as well as the search box at the top right, both added using prepend. there are other issues throughout in IE7 so i'm not sure if I'm on track thinking it's from the jQuery or not, or if there is a typo somewhere in my current mess of css!

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

Here is the script I'm using for the main menu which is not working in IE7, but works in other browsers - does anyone see a problem here?

<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'>•</span> <a id='practicesBtn' class='MainMenuModule' href='/practices/'>Practices</a> <span class='bullet'>•</span> <a id='locationsBtn' class='MainMenuModule' href='/locations/'>Locations</a></div>");

});
-->
</script>

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

Here is the link to the site: http://www.agencydr.squarespace.com Help is appreciated!!

推荐答案

当我通过IE7上的开发工具栏脚本控制台运行它时,您的前置功能可以正常工作,尽管它在加载时不起作用.您在IE8上遇到js错误,而在IE7上遇到两个错误. IE7上的另一个功能与此功能有关:

your prepend function works fine when I run it through the dev toolbar script console on IE7 although it doesn't work on load. You are getting a js error on IE8 and two on IE7. The additional one on IE7 is to do with this function:

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

第139行

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

Try removing this and see if the navigation works as expected on page load

编辑

轰,知道了.

尝试在'marginTop:-20'之后删除逗号 最后一个元素不应包含此元素,以为会影响所有旧版浏览器

Try removing the comma after 'marginTop: -20,' The last element shouldn't have this, think it affects all older browsers

这篇关于jQuery可以在除IE7之外的所有浏览器中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆