[英]How to get the url on the magnific popup API on open event?
如何獲得使用Magnific彈出API打開的URL? 我想在open事件回調中將它添加到window.location.hash
中:
<a href="page-title" class="mfp">Lorem ipsum</a>
$('.mfp').magnificPopup({
callbacks: {
open: function() {
var url = this.url
window.location.hash += '-'+url
}
}
});
我嘗試使用this.url
但沒有運氣。
找到了答案:
首先,通過console.log($.magnificPopup.instance)
,最后找到
this.currItem.src
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.