gpt4 book ai didi

jquery - jQuery css() 方法上的渐变过滤器

转载 作者:太空狗 更新时间:2023-10-29 12:27:00 25 4
gpt4 key购买 nike

我尝试更改其中一个页面的某些样式,我希望通过在用户脚本上使用 jQuery - css() 方法来更改样式。

我试过 jsfiddle ,我的浏览器使用了 Tampermonkey

一些属性样式改变了,但是gradient filter没有改变。这是页面上的样式:

#site-header .meta-header {
width: 100%;
min-width: 960px;
position: fixed;
top: 0;
left: 0;
right: 0;
height: 30px;
background-color: #1484ce;
filter: progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#FF1484CE', endColorstr='#FF1274B5');
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #1484ce), color-stop(100%, #1274b5));
background-image: -webkit-linear-gradient(top, #1484ce 0%,#1274b5 100%);
background-image: -moz-linear-gradient(top, #1484ce 0%,#1274b5 100%);
background-image: -o-linear-gradient(top, #1484ce 0%,#1274b5 100%);
background-image: linear-gradient(top, #1484ce 0%,#1274b5 100%);
-webkit-box-shadow: 0 2px 0 #0e5a8c;
box-shadow: 0 2px 0 #0e5a8c;
border-bottom: solid 1px rgba(255,255,255,0.1);
font-size: 13px;
}

这是我的用户脚本:

// ==UserScript==
// @name Change Style
// @namespace http://use.i.E.your.homepage/
// @include http://fiddle.jshell.net/tAKHd/show/light/
// @version 0.1
// @description enter something useful
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @grant GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a design change
introduced in GM 1.0. It restores the sandbox.
*/


$("body").css({
"background": "none",
"background-color": "#2f2f2f"
});

$("#site-header .meta-header").css({
"background-color": "#2c2c2c",

/*start - This is style not showing*/

"filter" : "progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#333333', endColorstr='#222222')",
"background-image": "-webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #333), color-stop(100%, #222))",
"background-image": "-webkit-linear-gradient(top, #333 0%,#222 100%)",
"background-image": "-moz-linear-gradient(top, #333 0%,#222 100%)",
"background-image": "-o-linear-gradient(top, #333 0%,#222 100%)",
"background-image": "linear-gradient(top, #333 0%,#222 100%)",

/* end */

"-webkit-box-shadow": "0 2px 0 rgba(0,0,0,0.25),inset 0 -1px 0 rgba(0,0,0,0.1)",
"box-shadow": "0 2px 0 rgba(0,0,0,0.25),inset 0 -1px 0 rgba(0,0,0,0.1)",
"border-bottom": "solid 1px rgba(255,255,255,0.1)"
});

我该如何解决?

最佳答案

好的,我的问题解决了

解决方案:

var meta = $("#site-header .meta-header")
meta.css("background-image", "-webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #333), color-stop(100%, #222))");
meta.css("background-image", "-webkit-linear-gradient(top, #333 0%,#222 100%)");
meta.css("background-image", "-moz-linear-gradient(top, #333 0%,#222 100%)");
meta.css("background-image", "-o-linear-gradient(top, #333 0%,#222 100%)");
meta.css("background-image", "linear-gradient(top, #333 0%,#222 100%)");

关于jquery - jQuery css() 方法上的渐变过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16696837/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com