问题解决了
将 jscrollpane 更新到支持 jquery 1.8 的最新版本! https://github.com/vitch/jScrollPane/blob/master/script/jquery.jscrollpane.min.js
我正在尝试在一段时间内用内容刷新 div。它将触发对呈现内容的 php 脚本的 Ajax GET 调用。第一次调用 ajax GET,ScrollPane 在那里,但第二次 Ajax GET(refresh) JScrollPane 消失了。任何如何重新初始化jscrollpane?
function getActivity(callback)
{
$.ajax({
url: '../../views/main/activity.php',
type: 'GET',
complete: function(){
$('#activityLineHolder').jScrollPane({
verticalDragMinHeight: 12,
verticalDragMaxHeight: 12
//autoReinitialize = true
});
},
success: function(data) {
var api = $('#activityLineHolder').jScrollPane(
{
verticalDragMinHeight: 12,
verticalDragMaxHeight: 12
}
).data('jsp');
api.getContentPane().html(data);
api.reinitialise();
}
});
setTimeout(callback,10000);
}
$(document).ready(function(){
(function getActivitysTimeoutFunction(){
getActivity(getActivitysTimeoutFunction);
})();
});
现在,我的滚动窗格在每次 Ajax 调用后都在那里,但它显示有问题,jscrollpane 会在每次 Ajax 调用后继续向左移动,慢慢地,它会隐藏内容。这是怎么回事?
foreach ($list as $notification) {
echo "<div class='feeds' id='$notification->notification_id'>";
$userObj = $user->show($notification->added_by);
echo $userObj->first_name.":<span class='text'>".$notification->activity."</span>";
echo " <span class='time'>".$notification_obj->nicetime($notification->created_at)."</span>";
echo "</div>";
}
像这样的东西,那是我的activity.php
这是我的截图,请任何人帮助我@_@ http://img31.imageshack.us/img31/6871/jscrollpane.png