如何调用IE CSS渐变属性 - >从Jquery过滤 [英] How to call IE CSS gradient property --> Filter from Jquery

查看:134
本文介绍了如何调用IE CSS渐变属性 - >从Jquery过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图从jquery为IE调用filter css方法,但是我不能这样做吗?

I have been trying to call filter css method from jquery for IE, but I am aint b able to do so?

我用的是什么?

    $('.gtob').mouseover(function(){
        $(this).css("background-image","-moz-linear-gradient(100% 100% 90deg, #373737, #000000)");
        $(this).css("background-image","-webkit-gradient(linear, 0% 0%, 0% 100%, from(#373737), to(#000000))");
        $(this).css("filter","progid:DXImageTransform.Microsoft.gradient( startColorstr='#373737', endColorstr='#000000',GradientType=0)");
    });

前两行适用于Firefox,Safari和Chrome,但IE声明没有响应:(

The first two lines works great for Firefox, Safari and Chrome but the IE statement give no response :(

那么,有人知道怎么做吗?

So, Anyone know how to do it ?

P:S!我试过-ms-filter没有任何事情发生

P:S! I have tried -ms-filter Nothing happens

推荐答案

如果您将这些样式移动到样式表中的类,我建议您的代码更清晰,然后为你的鼠标悬停做 .addClass() .removeClass()

I'd suggest that your code would be much cleaner if you moved those styles to a class in your stylesheet, and then do .addClass() and .removeClass() for your mouseover.

您没有指定您正在使用的IE版本,但是对于它的价值, filter 适用于IE6和IE7,但是IE8需要 -ms-filter 。后者还要求你转义过滤字符串中的引号。

You didn't specify which version of IE you're working with, but for what it's worth, filter is for IE6 and IE7, but IE8 requires -ms-filter. The latter also requires you to escape the quote marks in the filter string.

最后,你可能想看看 CSS3Pie ,这是所有IE版本的黑客,允许他们支持CSS渐变和边框-radius略高一些符合标准的方式。

Finally, you may want to check out CSS3Pie, which is a hack for all versions of IE to allow them to support CSS gradients and border-radius in a slightly more standards-compliant manner.

这篇关于如何调用IE CSS渐变属性 - >从Jquery过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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