在正确调用函数之前reinitialise()
(通过函数reinitializeScrollbar()
),函数将被执行。有谁知道为什么?
$(document).ready(function () {
$('.scrollContainer').jScrollPane();
$('[id^=arr]').click(function (event) {
var id = $(this).attr('id');
var index = id.substring(4);
//alert('Gib ID aus: ' +index);
var skillDesc = "#skillDescript" + index;
var arrTo2 = "#arr_" + index + ".arrow2";
var arrTo1 = "#arr_" + index + ".arrow1";
//alert('Gib skillDesc aus: ' +skillDesc);
event.preventDefault();
if ($(skillDesc).css("display") != "none") {
$(skillDesc).slideUp(800, reinitializeScrollbar());
console.log("ROLL IN!");
$(arrTo2).toggleClass("arrow2", "arrow1");
} else {
$(skillDesc).slideDown(800, reinitializeScrollbar());
console.log("ROLL OUT!");
$(arrTo1).toggleClass("arrow2");
}
});
function reinitializeScrollbar() {
$('.scrollContainer').data('jsp').reinitialise();
console.log("damn you");
}
});