Change css on current URL
Hello, I have one CMS with fixed layout. In that I have make few changes depends on my
current URL.
If I am on my home page so This class given below is
div.layout-column.column-main.with-column-1.with-column-2{
width:790;
}
And If I am of some other page so this same class look like this.
div.layout-column.column-main.with-column-1.with-column-2{
width:790;
}
I have tried it but it's not working properly.
- <script>
- if (location.href.indexOf("example.com") == 1) {
- document.write("<style>" +
- "div.layout-column.column-main.with-column-1.with-column-2{" +
- " width: 790px;" +
- "}" +
- "</style>");
- }
- else{
- document.write("<style>" +
- "div.layout-column.column-main.with-column-1.with-column-2{" +
- " width: 590px;" +
- "}" +
- "</style>");
- }
- </script>
I made this script but it's not give me proper output.