如何调用IE CSS渐变属性 -->从 Jquery 过滤
我一直在尝试从 IE 的 jquery 调用过滤器 css 方法,但我不能这样做?
我用什么?
$('.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 语句没有给出任何响应:(
所以,有人知道该怎么做吗?
P:S!我尝试过 -ms-filter 没有任何反应
I have been trying to call filter css method from jquery for IE, but I am aint b able to do so?
What I using ?
$('.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)");
});
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! I have tried -ms-filter Nothing happens
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议如果您将这些样式移至样式表中的类,然后执行
.addClass()
和.removeClass()
,您的代码会更加简洁你的鼠标悬停。您没有指定所使用的 IE 版本,但就其价值而言,
filter
适用于 IE6 和 IE7,但 IE8 需要-ms-filter
。后者还要求您转义过滤字符串中的引号。最后,您可能想看看 CSS3Pie,它是针对所有 IE 版本的 hack,允许它们支持 CSS 渐变和border-radius 以稍微更符合标准的方式。
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.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.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.
我认为梯度必须大写?
I think gradient has to be capitalized?