簡體   English   中英

如何在打開事件時獲取壯觀的彈出式API上的網址?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM