1

我的网站上有一个 jquery 手风琴,并在手风琴的第一部分内的 div 上放置了一个 nicescroll。

当我继续手风琴的下一部分并显示新内容时,上一部分的 nicescrollbar 仍然可见。

如何在移动到手风琴的其他部分时将其移除?

<script type="text/javascript">
jQuery(document).ready(function () {
    $("#wizard").accordion({
        heightStyle: "content"
    });
    $('#wizard').accordion();
    $('#wizard button').click(function (e) {
        e.preventDefault();
        var delta = ($(this).is('.next') ? 1 : -1);
        $('#wizard').accordion('option', 'active', (
        $('#wizard').accordion('option', 'active') + delta));
    });
    $("#boxscroll").niceScroll({
        touchbehavior: false,
        cursorcolor: "#34759a",
        cursoropacitymax: 0.7,
        cursorwidth: 7,
        cursorborder: "1px solid #2848BE",
        cursorborderradius: "8px",
        background: "#ccc",
        autohidemode: false
    });
});
</script> 
4

1 回答 1

0

我只是将所有内容放在一个 div 中,并将其 id (scrollContent) 添加到脚本中。

$("#boxscroll").niceScroll({
    "#scrollContent", 
    touchbehavior: false,
    cursorcolor: "#34759a",
    cursoropacitymax: 0.7,
    cursorwidth: 7,
    cursorborder: "1px solid #2848BE",
    cursorborderradius: "8px",
    background: "#ccc",
    autohidemode: false
});
于 2014-07-04T12:10:16.453 回答