Problem with fancybox in PrestaShop 1.7 - how to use it?


Hello, I try to open a lightbox in my 1.7 Prestashop. I want to add a "ask for a price" button which opens a contact form in a lightbox. Do you have a modul I could use for this or can you help me with the last step? My code so far: 
$('a.enlace').fancybox({
    type: 'iframe',
    fitToView: true,
    autoSize: true,
    height: '90%',
    width: '60%',
    openEffect: 'fade',
    openSpeed: 'slow'
});

Where do I have to put the javascript into, everything I tried isn´t working. But the button itself is placed. It´s just opening the contactform in a new window. Kind regards Tim 

how to use jquery / javascripts in PrestaShop 1.7

hello,
Jquery scripts that you show on the example do not work in prestashop 1.7 anymore. in prestashop 1.7 it is necessary to use different way to run the scripts.
Simply saying, Scripts that uses jquery ($) are not working while they are added to page body. its necessary to move these scripts to .js file.
In this case you have to paste this script to your theme's main .js file, put it to the document ready function:
$(document).ready(function(){
// script here 
});
then it should work properly.
it is worth to mention that not each page in prestashop has "fancybox" library, in this case it will be necessary to include it to other pages too (if you want to use this kind of popup on pages other than product pages).





Share on Google Plus

About VEKIA

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments:

Post a Comment