简体   繁体   English

jQuery按钮在整个网站上禁用CSS?

[英]JQuery button to disable CSS across entire website?

I want to make these buttons which enable/disable the css across an entire website I am making. 我要制作这些按钮,以在我制作的整个网站上启用/禁用CSS。 I am trying to make it so when a user clicks the button to disable/enable the css, it does so across all the webpages of the site and not just for the page a user is on. 我正在尝试做到这一点,以便当用户单击按钮禁用/启用css时,它会在网站的所有网页上进行操作,而不仅仅是用户所在的页面。

So far, my code to enable/disable the css is as follows 到目前为止,我启用/禁用CSS的代码如下

<script>
$("#text-only").click(function () { jQuery('#mainStyleSheet').remove();}); 
$("#renable-style").click(function () {$('head').append('<link href="css/style.css" rel="stylesheet" id="mainStyleSheet" />');});
</script>

Any ideas? 有任何想法吗?

{$('head').append('<link href="css/style.css" rel="stylesheet" id="mainStyleSheet" />');}); 

代替

{$('head').html('<link href="css/style.css" rel="stylesheet" id="mainStyleSheet" />');});

我认为您应该为网页中创建的每个对象添加一个css类。在该类中进行所有更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM