Jump to:

1347 Posts in 439 Topics by 514 members

Themes

SilverStripe Forums » Themes » Custom javascript failing in evergreenz theme

Discuss SilverStripe Themes.

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

Page: 1
Go to End
Author Topic: 317 Views
  • dario.mx
    Avatar
    Community Member
    2 Posts

    Custom javascript failing in evergreenz theme Link to this post

    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
  • Dazman1
    Avatar
    Community Member
    30 Posts

    Re: Custom javascript failing in evergreenz theme Link to this post

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

  • dario.mx
    Avatar
    Community Member
    2 Posts

    Re: Custom javascript failing in evergreenz theme Link to this post

    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.

    317 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.