Question

I'm using a custom theme registered the js in the skin.xml and created a folder in the browser with the script.

The script from a user here:

$(document).ready(function(){

    if( localStorage.theme )
        $('link#theme').attr('href', localStorage.theme);

    $('#scheme1').click(function(){
        $('link#theme').attr('href', "scheme1.css");
        localStorage.theme = "scheme1.css;"
    })

    $('#scheme2').click(function(){
        $('link#theme').attr('href', "scheme2.css");
        localStorage.theme = "scheme2.css;"
    })

});

In my main template I put:

<link  id='theme'  href type='text/css' rel="stylesheet" />

now I want to "call" this script when I use this code

<a id='scheme1' href='#'>Click</a>

in a template. With the scheme1.css

.footer{
    background: #000;
}

The color should change but I somehow the script isn't working. Any ideas?

Était-ce utile?

La solution

If you want your js file be registered, you have to add it in the jsregistery.xml in your profile folder.

This will add it to the portal_javascript and then your script will be loaded in your page.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top