Jump to:

3435 Posts in 1026 Topics by 866 members

Template Questions

SilverStripe Forums » Template Questions » fancybox or shadowbox not showing

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

Page: 1 2
Go to End
Author Topic: 7968 Views
  • tchintchie
    Avatar
    Community Member
    63 Posts

    Re: fancybox or shadowbox not showing Link to this post

    hmmm yes that makes sense on a normal html static website but since in silverstripe the JS on my template is described like this:

    <% require javascript(mysite/javascript/shadowbox-3.0.3/shadowbox.js) %>

    where do I put the init()???

    sorry for being so clueless!!

  • Invader_Zim
    Avatar
    Community Member
    141 Posts

    Re: fancybox or shadowbox not showing Link to this post

    Hmmm, you could write the code directly to your template beneath your <% require ... %> ...
    or you could create a javascript file called "shadowbox_setup.js" in /mysite/javascript, write Shadowbox.init(); to it, and require this file in your template :

    <% require javascript(mysite/javascript/shadowbox-3.0.3/shadowbox.js) %>
    <% require javascript(mysite/javascript/shadowbox_setup.js) %>


    ...
    or you delete these <% require ...%> thingies from the template and add this to the init() method of the Controller class of the Page type:

    function init() {
    parent::init();
    Requirements::javascript('mysite/javascript/shadowbox-3.0.3/shadowbox.js');
    Requirements::customScript('<script type="text/javascript">Shadowbox.init();</script>');
    }

    ^^Hope this is somewhat understandable, cause we have a nice party going on and i allready had some beer

    Cheers

  • tchintchie
    Avatar
    Community Member
    63 Posts

    Re: fancybox or shadowbox not showing Link to this post

    aaaaaah thank you so much!!! the first method did the trick...however not until after I noticed that I forgot to include the shadowbox.css as well....now that this is solved it finally works!!

    thanks so much! You´ve always been a great help (especially when drunk ;-)
    have a nice party!

    PROST!

    7968 Views
Page: 1 2
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.