jquery accordion collapsed by default on page load

前端 未结 6 1580
深忆病人
深忆病人 2020-12-20 21:23

I am using JQuery UI accordion in my page. I have following Javascript code on my page load:

$(function() {
    $(\"#accordion\").accordion({
            act         


        
6条回答
  •  再見小時候
    2020-12-20 22:04

    It's probably loading something near the end of the page slowly. If you can't fix that, you could try declaring the element having display:none applied to it in css, then:

    $("#accordion").show().accordion({
            active: false,
            autoHeight: false,
            navigation: true,
            collapsible: true
        });
    

    There could be a cleaner way of doing that (as @Mrchief suggests), but I don't think .accordion() formats hidden elements nicely. You'll have to test.

提交回复
热议问题