• Resolved Tasos Koukouvitis

    (@tasoskoukhotmailcom)


    Hello Vision team,

    I have tried to add some custom events to the map using JS/JQuery but there is no change. Is there a specific way to make the code work or maybe a setting I need to change?

    Thanks a lot

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Avirtum

    (@avirtum)

    Hello. What kind of events do you want to add?

    • This reply was modified 2 years, 1 month ago by Avirtum.
    Plugin Author Avirtum

    (@avirtum)

    You can use this code below, just copy & paste it to the custom js section.

    
    const instance = this;
    const $ = jQuery;
    let visible = true;
    
    instance.$container.on('click', (e) => {
        if($(e.target).hasClass('vision-image')) { // only from the image map and not from other elements
            visible = !visible;
            instance.$container.find('.vision-layers').css({'display': visible ? '' : 'none'});
            instance.$container.find('.vision-tooltips').css({'display': visible ? '' : 'none'});
            instance.$container.find('.vision-popovers').css({'display': visible ? '' : 'none'});
        }
    });
    
    • This reply was modified 2 years, 1 month ago by Avirtum.
    Thread Starter Tasos Koukouvitis

    (@tasoskoukhotmailcom)

    Hi!

    Many thanks for your awesome support & script sent

    Best, Tasos

    Plugin Author Avirtum

    (@avirtum)

    I added another code Maybe it will help someone too.

    
    const instance = this;
    const $ = jQuery;
    let visible = true;
    
    instance.$container.on('click', (e) => {
        if($(e.target).hasClass('vision-image')) { // only from the image map
            visible = !visible;
           
            instance.$container.find('.vision-layers .vision-layer').each((index, el) => {
               const id = $(el).data('layer-id');
               visible ? instance.hideTooltip(id) : instance.showTooltip(id);
            });
        }
    });
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add custom events using JS/JQuery’ is closed to new replies.