我使用jquery工具的叠加插件。在覆盖中,我加载了一个特定的url。url加载在叠加后,我如何从jquery得到这个url ?
更新:我的代码看起来像jquery覆盖打开外部链接的例子
我想知道url的原因是因为我在那里设置了一些参数,我想访问
使用基本代码:
// if the function argument is given to overlay,
// it is assumed to be the onBeforeLoad event listener
$("a[rel]").overlay({
mask: 'darkred',
effect: 'apple',
onBeforeLoad: function() {
// grab wrapper element inside content
var wrap = this.getOverlay().find(".contentWrap");
// load the page specified in the trigger
wrap.load(this.getTrigger().attr("href"));
// save the currently-loaded URL as a data field on the wrapper
wrap.data('currenturl',this.getTrigger().attr("href"));
}
});
那么你所需要得到的URL是这样的:
$(".contentWrap").data('currenturl');