请按照下面的代码详细了解我的未重新初始化的 jscrollpane。评论将帮助您理解代码。
//in the main php file styles -
live-demo {width: 550px;height:500px;overflow: auto; }
//under script tag
var ms_js = jQuery.noConflict();
ms_js(function(){
ms_js('#live-demo').My_func
({
id:'2211155996',...... // all params for this function call located in antoher js file
});
//in the external js file -
(function($) {
$.fn.My_func = function(options) {
...all data getting codes here by ajax which outputs data to #live-demo...
...
//also here have jscrollpane declaration for live-demo div
jQuery.noConflict();
jQuery(function(){ jQuery('#live-demo'+o.show_suffixs+'').jScrollPane(); });
})(jQuery);
//in the main php file again under script tag
ms_js("#msfb_clickbtn").click(function(){
var container = ms_js('#live-demo');
var api = container.data('jsp');
ms_js('#live-demo').My_func({
id:'2211155996',...//call again for data as above
});
api.reinitialise();
});
//script ends
//this button click call to reaload ajax data again as above script does
input id="msfb_clickbtn" type="button" value="test"
但是在按钮单击时,我看到数据已加载到实时演示 div 中,但未显示滚动窗格