admin管理员组文章数量:1026989
I am very new to javascript. I am creating a multilingual website. It contains rtl and ltr languages. I have two css for those to languages. When user change his language I want to load respective css file. Is it possible in this way ? If not suggest any alternative way.
I am very new to javascript. I am creating a multilingual website. It contains rtl and ltr languages. I have two css for those to languages. When user change his language I want to load respective css file. Is it possible in this way ? If not suggest any alternative way.
Share Improve this question edited May 24, 2016 at 14:26 madhan kumar asked May 24, 2016 at 13:22 madhan kumarmadhan kumar 1,6082 gold badges27 silver badges38 bronze badges 8- why do you want to do this? are you unable to edit the html to remove the files you don't want? – Cruiser Commented May 24, 2016 at 13:27
- Actually, I am trying to change css file dynamically. – madhan kumar Commented May 24, 2016 at 13:28
- 2 @madhankumar you cannot do that. But you can always change the CSS individual properties dynamically – Ahs N Commented May 24, 2016 at 13:31
- 1 You can't disable css files with javascript. The proper way of doing it would be to add/remove css classes with javascript and/or use css media queries to display certain rules when you want to. Google CSS Media Queries and Changing CSS Class with javascript/jquery. – Dan Weber Commented May 24, 2016 at 13:36
- 2 see this answer: stackoverflow./questions/25827756/… – Cruiser Commented May 24, 2016 at 13:37
1 Answer
Reset to default 5Is posible enable and disable css stylesheet with javascript. A example: http://plnkr.co/0exLXB
function del_style() {
document.getElementById("styles").disabled=true;
}
function add_style() {
document.getElementById("styles").disabled=false;
}
I think you could adapt the code for your site
I am very new to javascript. I am creating a multilingual website. It contains rtl and ltr languages. I have two css for those to languages. When user change his language I want to load respective css file. Is it possible in this way ? If not suggest any alternative way.
I am very new to javascript. I am creating a multilingual website. It contains rtl and ltr languages. I have two css for those to languages. When user change his language I want to load respective css file. Is it possible in this way ? If not suggest any alternative way.
Share Improve this question edited May 24, 2016 at 14:26 madhan kumar asked May 24, 2016 at 13:22 madhan kumarmadhan kumar 1,6082 gold badges27 silver badges38 bronze badges 8- why do you want to do this? are you unable to edit the html to remove the files you don't want? – Cruiser Commented May 24, 2016 at 13:27
- Actually, I am trying to change css file dynamically. – madhan kumar Commented May 24, 2016 at 13:28
- 2 @madhankumar you cannot do that. But you can always change the CSS individual properties dynamically – Ahs N Commented May 24, 2016 at 13:31
- 1 You can't disable css files with javascript. The proper way of doing it would be to add/remove css classes with javascript and/or use css media queries to display certain rules when you want to. Google CSS Media Queries and Changing CSS Class with javascript/jquery. – Dan Weber Commented May 24, 2016 at 13:36
- 2 see this answer: stackoverflow./questions/25827756/… – Cruiser Commented May 24, 2016 at 13:37
1 Answer
Reset to default 5Is posible enable and disable css stylesheet with javascript. A example: http://plnkr.co/0exLXB
function del_style() {
document.getElementById("styles").disabled=true;
}
function add_style() {
document.getElementById("styles").disabled=false;
}
I think you could adapt the code for your site
本文标签: phpEnable and disable css file dynamically using javascriptStack Overflow
版权声明:本文标题:php - Enable and disable css file dynamically using javascript? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745657185a2161666.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论