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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Best Way to implement a lightbox feature


Reply

10 Posts   2507 Views

Avatar
arthurdent

6 July 2013 at 4:26pm Community Member, 166 Posts

<embarassed>OK -- I was missing a script or two</embarassed>

So now I've locked and loaded the following:

class Page_Controller extends ContentController {
   public static $allowed_actions = array(
   );

   public function init() {
      parent::init();
      Requirements::javascript(THIRDPARTY_DIR.'/jquery/jquery.min.js'); //include jquery bundled with ss
      Requirements::javascript('themes/'. SSViewer::current_theme() .'/javascript/lightbox.js'); //link to js file in current theme folder
      Requirements::javascript('themes/'. SSViewer::current_theme() .'/javascript/effects.js');
      Requirements::javascript('themes/'. SSViewer::current_theme() .'/javascript/prototype.js');
      Requirements::javascript('themes/'. SSViewer::current_theme() .'/javascript/scriptaculous.js');
      Requirements::javascript('themes/'. SSViewer::current_theme() .'/javascript/builder.js');
   }
}

I now have two instances of builder.js and effects.js showing up -- but lightbox still isn't working... ?

Avatar
IOTI

10 July 2013 at 12:32am Community Member, 189 Posts

Any luck getting it to work?

If you're still having issues, I would try limiting your Requirements to just the files you need for the lightbox to work (which i'm guessing are jquery.min.js and lightbox.js).

Some other considerations:

1. Are you also firing a script to initialize the lightbox? (assuming lightbox.js is a js library).
2. Do you have the correct css class on your links in the template?
3. When you click a link that is suppose to open a lightbox, are there any errors in firebug/chrome developer tools?