Jump to content

Fancybox on 1.5.5


Recommended Posts

add somewhere in header.tpl file (in <head></head> section)

<script>
{literal}
 $(document).ready(function() {
  $(".iframe").fancybox({
   autoSize: false,
   autoDimensions: false,
   width: 630,
   height: 425,
   fitToView: false,
   padding: 0,
   title: this.title,
   href: $(this).attr('href'),
   type: 'iframe'
  });
 });
{/literal}
</script>

and in addition to this, make sure that fancybox libraries are attached to <header> section. If they aren't - you will need to modify front controller (classes/frontcontroller.php) and its setmedia() function

Link to comment
Share on other sites

ok so you probably need to add fancybox libraries to controllers 

(im not sure because i havent got access to your front office and i cant inspect code)

 

you can try with:

 

open: classes/Controllers/FrontController.php

 

 

there is function setMedia();

 

add there:

$this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen');
$this->addJqueryPlugin('fancybox');

(add this code right after first bracket { )

 

it should look like:

	public function setMedia()
	{
	    $this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen');
            $this->addJqueryPlugin('fancybox');
Link to comment
Share on other sites

  • 1 month later...

Hi - I wanted to do the same thing. I applied the code above and got an error telling me that jQuery was not loaded so I changed your code to the following which worked.

public function setMedia()
{
$this->addjquery();
$this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen');
$this->addJqueryPlugin('fancybox');

If possible could you please confirm that adding this extra line of code will not cause issues elsewhere due to duplication

Link to comment
Share on other sites

×
×
  • Create New...