简体   繁体   English

jQuery UI Button在IE 7上不起作用

[英]jQuery UI Button doesn't work on IE 7

I have this code: 我有以下代码:

<script type="text/javascript" src="<?=$path?>common/_LIB/3rd/jquery/jquery-ui-1.8.16/js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="<?=$path?>common/_LIB/3rd/jquery/jquery-ui-1.8.16/js/jquery-ui-1.8.16.custom.min.js"></script>
<link type="text/css" href="<?=$path?>common/_LIB/3rd/jquery/jquery-ui-1.8.16/css/ui-lightness/jquery-ui-1.8.16.custom.css" rel="stylesheet" />

<script>
    $(function() {
            $('.button,.button floatRight').button();
    });
</script>

and

<a class="button floatRight" href="handset_list.php"><?=$reprint?></a>

and all is well on Chrome and FF, IE 9, but on IE 8 and IE 7, I can't see the button for the above link only. 而且在Chrome和FF,IE 9上一切正常,但是在IE 8和IE 7上,我看不到上面链接的按钮。

You have an error in your code in jQuery selector. 您在jQuery选择器中的代码中有错误。 There is no tag name called "floatRight" . 没有名为“ floatRight”的标签名称。 Try this: 尝试这个:

$('.button').button();

尝试以下代码:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

You probably mean 你可能是说

$(function() {
        $('.button,.button floatRight').button();
});

A space in the tag attribute means there are two classes. tag属性中的空格表示有两个类。 In your case the button you try to target has two classes: button and floatRight . 在您的情况下,您尝试定位的按钮具有两个类: buttonfloatRight Hence two dots. 因此有两个点。

EDIT: 编辑:
I found something else: the function $("#something").button(); 我发现了其他东西:函数$("#something").button(); calls $.data a lot of times. 多次调用$.data According to caniuse.com IE only has partial support for custom data on attributes, So, it may not work as the jQuery UI developers think it would in IE 7. The many calls to $.data make me think the .button() function kind of relies on it (but I don't really understand it yet, I just had a quick glance). 根据caniuse.com的说法,IE仅部分支持属性中的自定义数据,因此,它可能无法像jQuery UI开发人员所认为的那样在IE 7中.button()$.data的多次调用使我认为.button()函数有点依赖它(但是我还不太了解,我只是看了一眼)。 If that is so, that is probably the cause. 如果是这样,那可能是原因。 If you really need IE 7 support I suggest using a jQuery UI build released when IE 7 was the most used IE, although that might not support all features you use now. 如果您确实需要IE 7支持,我建议您使用IE 7是最常用的IE时发布的jQuery UI构建,尽管它可能不支持您现在使用的所有功能。 I'd say just let IE 7 users see an anchor. 我想说的只是让IE 7用户看到一个锚点。 What's so bad about an anchor? 锚有什么不好的呢?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM