Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bootstrap popover和部分呈现-jquery.on()_Jquery_Ajax_Twitter Bootstrap_Yii_Popover - Fatal编程技术网

Bootstrap popover和部分呈现-jquery.on()

Bootstrap popover和部分呈现-jquery.on(),jquery,ajax,twitter-bootstrap,yii,popover,Jquery,Ajax,Twitter Bootstrap,Yii,Popover,我有一个使用cgridview的Yii应用程序,它使用ajax分页。人们的常见问题-当您分页时,您将失去与jquery的绑定。例如,我的Popover停止工作(除其他外) 我的popover功能如下: $('.myclass').popover({ trigger: 'hover', show: true, html: true }); 如何使用jquery.on()事件处理重写此函数?或者有其他解决方案吗?您可以使用popover的选择器属性来预绑定它们 var po

我有一个使用cgridview的Yii应用程序,它使用ajax分页。人们的常见问题-当您分页时,您将失去与jquery的绑定。例如,我的Popover停止工作(除其他外)

我的popover功能如下:

$('.myclass').popover({
    trigger: 'hover',
    show: true,
    html: true
});

如何使用jquery.on()事件处理重写此函数?或者有其他解决方案吗?

您可以使用popover的
选择器
属性来预绑定它们

var popOverSettings = {
    trigger: 'hover',
    show: true,
    html: true,
    selector: '.myclass'
}

$('body').popover(popOverSettings);

另一个选项是设置ajaxComplete处理程序。这对我很有用:

// Enable popovers for Ajax content
$(document).ajaxComplete(function() {
    $('[data-toggle="popover"]').popover({ trigger: 'hover', html: true }).click(function(evt) {
      evt.preventDefault();
    });
});

PSL这看起来不错,而且很有效,只是html不再正确呈现。你对这个问题有什么想法吗?你有没有一把小提琴或什么东西来复制这个问题。有人展示过爆米花吗?很好!因此,我们必须在html中使用data html=“true”。谢谢。@lilbuitch是的,那会有用的。事实上,您已经知道的许多属性(如event trigger)都可以是数据属性(如
data trigger=“hover”
),您知道为什么它以前作为javascript属性工作,但不使用此解决方案吗?这没什么大不了的,但知道这一点可能会有所帮助。