jQuery css渐变 [英] jQuery css gradient

查看:85
本文介绍了jQuery css渐变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要在元素上使用渐变背景,我会这样做:

To have a gradient background on an element I do something like this:

.css('filter','progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#FFFFFF\', endColorstr=\'#'+event.backgroundColor+'\', gradientType=1)')
.css('background-image','-webkit-gradient(linear, left top, right bottom, color-stop(0.1, #FFFFFF), color-stop(0.99, #'+event.backgroundColor+'))')
.css('background-image','-moz-linear-gradient(top left, #FFFFFF 0%, #'+event.backgroundColor+' 100%)')
.css('background-image','-o-linear-gradient(top left, #FFFFFF 0%, #'+event.backgroundColor+' 100%)')

现在,不是jQuery假设消除所有与跨浏览器兼容性问题相关的工作?有什么更好的方法来做到这一点。没有使用任何额外的插件?

Now, isn't jQuery suppose to eliminate all the work related to cross-browser compatibility issues? is there any better way to do that. Without using any additional plugins?

推荐答案

有一个jQuery插件用于使用渐变。我从来没有使用它,但看起来很简单

there is a jQuery plugin used to work with gradient. i have never used it but it looks simple

http ://plugins.jquery.com/project/gradient

他如何使用它:

http://www.julien-verkest.fr/13/11/2007/jquery-gradient-le-plugin-qui-permet-de-creer-dynamiquement-des-backgrounds-degrades

或您可以使用Gradientz

or you could use use Gradientz

http://jquerystyle.com/2009/08/06/gradientz

Gradientz看起来甚至更完整和易于使用。到你好运气伙伴。

Gradientz looks even more complete and easy to use. Up to you good luck buddy.

这篇关于jQuery css渐变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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