• Resolved ralphmueller12

    (@ralphmueller12)


    Hello,
    we consider to buy the full version of vision for our company, however, theres one feature which we need.
    Is it possible that when I went to the Data section and add an URL to a Layer to read the URL later out at the custom jss part?

    The reason for this is, that when i click on a layer, it should not be a link or open in a new tab, instead a specific part of the conent from the url target should appear in an iframe. I already got that part, what i still need is the URL of a layer.

    Is there any Approach or best practice for this you could recommend?

    Thanks a lot in advice

    Ralph

Viewing 1 replies (of 1 total)
  • Plugin Author Avirtum

    (@avirtum)

    You can you something like this in the custom js section.

    var instance = this,
    $ = jQuery;
    
    function getLayer(id) {
        for(var i=0;i<instance.layers.length;i++) {
            var layer = instance.layers[i];
            if(layer.cfg.id == id) {
                return layer;
            }
        }
        return null;
    }
    
    instance.$container.on('click', '.vision-layer', function(e) {
        var layerId = $(this).data('layer-id'),
        layer = getLayer(layerId);
       
        if(layer) {
            console.log(layer.cfg.userData);
        }
    });
Viewing 1 replies (of 1 total)
  • The topic ‘Get URL from Layer in custom JSS’ is closed to new replies.