Bootstrap 3.0 affix with list changes width

前端 未结 9 1664
一向
一向 2021-02-01 14:56

I\'m migrating to bootstrap 3.0.0 and I\'m having issues with an affixed menu to the left: as soon as it becomes affixed (after 10px scroll), its width changes. In this fiddle i

9条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-01 15:37

    Here's another version:

    $('.sitebar .affix-top').width($('.sitebar .affix-top').width());
    $(window).resize(function () {
        $('.sitebar .affix').width($('.sitebar .affix-top').width());
    });
    $(window).scroll(function () {
        $('.sitebar .affix').width($('.sitebar .affix-top').width());
    });
    

提交回复
热议问题