Magnific-popup: Get data from the element that triggered the popup

Created on 24 May 2013  路  2Comments  路  Source: dimsemenov/Magnific-Popup

Im trying to get info from the element that triggered the popup, but it doesn't work.

This is the code im using: http://codepen.io/seraphzz/pen/AHIbl

$(this) isnt defined. Is it possible to access the element within one of the callback functions?

Most helpful comment

this in callbacks is Magnific Popup object, not a target jQuery element. If you want to get the element that was clicked:

beforeOpen: function() {
      console.log(this.st.el);
    }

All 2 comments

this in callbacks is Magnific Popup object, not a target jQuery element. If you want to get the element that was clicked:

beforeOpen: function() {
      console.log(this.st.el);
    }

Thanks for the fast reply! Worked like a charm.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amir-rahnama picture amir-rahnama  路  4Comments

tevart picture tevart  路  3Comments

mifas picture mifas  路  5Comments

klihelp picture klihelp  路  4Comments

landitus picture landitus  路  3Comments