Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Themes /

Discuss SilverStripe Themes.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Custom javascript failing in evergreenz theme

Go to End

3 Posts   1334 Views


Community Member, 2 Posts

17 November 2013 at 10:01am

Edited: 17/11/2013 10:08am

Hi folks,

I have made some javascript code to achieve a simple effect on a list of links; it basically displays one image associated to each link when such is clicked (and disappears it if is clicked again, so is like a toggle). The images are not loaded until we click at least once.

Attached are the files for an stand alone demo of the mentioned feature (it refers to images which are available as assets already, in my SS site; so this should not be a matter of not found resources on server).

Now, I have modified the theme template files already and I can verify that the javascript/css is being included in the head of each html page (I know there are other cleaner approaches, but I just want it work for the moment).

I also needed to change the configuration of the editor, to allow me putting custom attributes as those in the sample; but I finally made it (again, the source of the generated pages do show desired custom attributes).

The current issue is that the effect simply does not work inside SilverStripe; unsure why. Nothing happens when I click the links, when they occur inside a page generated in SS with customized theme. The Javascript console does not report any error.

Any ideas? I am almost sure this is not exclusive of the theme I am using, but mentioning just in case.

Thank you a lot in advance folks,


Community Member, 55 Posts

3 December 2013 at 6:26am

Do you have a link for the version which your working on?


Community Member, 2 Posts

3 December 2013 at 4:35pm

Hi Dazman1,

Thanks for your reply, although I must share that the JS is working now ;-|

The main caveats were:

1) HTML editor was removing some custom attributes that the JS code needed.

2) I was enclosing the JS code in head between XML comments, and that prevented it from being properly read.

Thanks everyone.