Jump to content

Edit History

huymanutd

huymanutd


Added format for code

On 9/28/2018 at 8:30 PM, NickyPrestashop said:

Pour activer fancybox
ouvrir le fichier classes/controller/FrontController.php

Et ajouter $this->addJqueryPlugin('fancybox');

dans la fonction initContent()

Ensuite ouvrir themes/classic/assets/js/custom.js et y ajouter

$(document).ready(function() {   
    $(".ma_classe").fancybox();

});

et pour finir ajouter la classe "ma_classe" à vos éléments sur lesquels vous souhaitez obtenir l'effet

This works for me (currently v1.7.6.4) . Thank you!

The only thing I would add is to override the core controllers/front/CmsController.php file with override/controllers/front/CmsController.php

The full steps are:

1) Create a new file in override/controllers/front/CmsController.php with the following content:

class CmsController extends CmsControllerCore
{
    public function setMedia()
    {
        parent::setMedia();
        $this->addCSS(_PS_CSS_DIR_.'jquery.fancybox.css', 'screen');
        $this->addJqueryPlugin('fancybox');

    }
}

2) Add the JS call in the custom.js file of the theme e.g themes/classic/assets/js/custom.js

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

3) Add the link to the CMS 's page content
 

<a href="https://<url>/img/cms/IMG_4274.jpg" class="fancybox">
  <img src="https://<url>/img/cms/IMG_4274.jpg" alt="IMG_4274.jpg" width="300" height="225" />
</a>

 

huymanutd

huymanutd

On 9/28/2018 at 8:30 PM, NickyPrestashop said:

Pour activer fancybox
ouvrir le fichier classes/controller/FrontController.php

Et ajouter $this->addJqueryPlugin('fancybox');

dans la fonction initContent()

Ensuite ouvrir themes/classic/assets/js/custom.js et y ajouter

$(document).ready(function() {   
    $(".ma_classe").fancybox();

});

et pour finir ajouter la classe "ma_classe" à vos éléments sur lesquels vous souhaitez obtenir l'effet

This works for me (currently v1.7.6.4) . Thank you!

The only thing I would add is to override the core controllers/front/CmsController.php file with override/controllers/front/CmsController.php

The full steps are:

1) Create a new file in override/controllers/front/CmsController.php with the following content:

class CmsController extends CmsControllerCore
{
    public function setMedia()
    {
        parent::setMedia();

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

        $this->addJqueryPlugin('fancybox');

    }
}

2) Add the JS call in the custom.js file of the theme e.g themes/classic/assets/js/custom.js

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

});

3) Add the link to the CMS 's page content

<a href="https://<url>/img/cms/IMG_4274.jpg" class="fancybox">

<img src="https://<url>/img/cms/IMG_4274.jpg" alt="IMG_4274.jpg" width="300" height="225" />

</a>

×
×
  • Create New...