Jump to content
thirty bees forum
  • 0

Can I get blockbanner to open a picture in fancybox on every page?



I'm already using fancybox to display pictures in a CMS gallery page, which I accomplished by putting this javascript into 'Custom Code' in the back office:

$(document).ready(function() { $("a.fancybox").fancybox(); });

So for the banner link I thought, 'Great, I probably just need to edit blockbanner.tpl to append class="fancybox" to the URL.' But nothing is ever that straightforward, is it? It actually works on CMS and product pages, but not on the home, category or search pages. I've tried putting that js directly into the global.js file and the index.js file but it doesn't work. Any ideas what, if anything, I can do to fix this?

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Investigating further I remembered I'd also had to insert these two lines…

$this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen'); $this->addJqueryPlugin('fancybox'); …at the bottom of the setMedia function in CMSController.php so I guess that's why it's working on CMS pages. Is there somewhere I could put this code – or something similar – so that fancybox will work wherever it's called from?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...