我在ASP页面上使用tipsy jQuery插件。 我在母版页的页面加载时激活它:
if (jQuery.fn.tipsy) {
$('.north').tipsy({ gravity: 'n', fade: true });
$('.south').tipsy({ gravity: 's', fade: true });
$('.east').tipsy({ gravity: 'e', fade: true });
$('.west').tipsy({ gravity: 'w', fade: true });
}
当我进行回调时会出现问题,插件所针对的元素会被刷新并且不再被注册。
有没有办法在回调后让插件在这些元素上保持活动状态,还是应该重新初始化它?
答案 0 :(得分:0)
您必须重新初始化插件。内部Page_Load
在回发时触发客户端事件:
if (Page.IsPostBack) {
RadScriptManager.RegisterStartupScript(Page, Page.GetType(), "postback", "$.event.trigger({type:'postback.event'})", true);
}
在js:
$(document).on('postback.event', () => {
// Init plugin
});