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.

Themes

Discuss SilverStripe Themes.

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

Custom javascript failing in evergreenz theme


Reply

3 Posts   630 Views

Avatar
dario.mx

17 November 2013 at 10:01am (Last edited: 17 November 2013 10:08am), Community Member, 2 Posts

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,
Cheers.

Attached Files
Avatar
Lexandclo

3 December 2013 at 6:26am Community Member, 34 Posts

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

Avatar
dario.mx

3 December 2013 at 4:35pm Community Member, 2 Posts

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.