请按照下面的代码详细了解我的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"
但是点击按钮我看到在live-demo div中加载的数据但滚动窗格没有显示