Magnific popup: Get current element in callback

后端 未结 6 1304
借酒劲吻你
借酒劲吻你 2020-12-06 05:58

In Magnific Popup, I want to get an attribute in the link that is clicked and use it in a callback function (using callbacks: open) to make some changes in the DOM.

6条回答
  •  长情又很酷
    2020-12-06 06:52

    // "item.el" is a target DOM element (if present)
    // "item.src" is a source that you may modify
    open: function(item) {}
    

    and use data-attributes, to example data-myatt - that get:

    $(this).data('myatt')
    

提交回复
热议问题