gpt4 book ai didi

jquery 更改整个文档的默认 css

转载 作者:行者123 更新时间:2023-11-28 04:27:56 25 4
gpt4 key购买 nike

<style>
.foo {
color: red; <-- how to change this from jquery
}
</style>

如何在没有 $() 选择器的情况下更改 jquery 的默认 css?所以整个元素包含类会改变吗?

最佳答案

你可以使用 javascript :

<head>
<link id="style" rel=stylesheet href="large.css">

</head>

function changeStyle(){
if(window.innerWidth<900){
document.getElementById("style").setAttribute("href","small.css");

}else if((window.innerWidth)>900 &&(window.innerWidth)<1200){
document.getElementById("style").setAttribute("href","medium.css");
}
else
document.getElementById("style").setAttribute("href","large.css");
}
window.onresize=changeStyle;
changeStyle();

关于jquery 更改整个文档的默认 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41874513/

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