---
# System prepended metadata

title: 手風琴點了移到上方
tags: [Bootstrap]

---

---
tags: Bootstrap
---
# 手風琴點了移到上方

```javascript=1
$(function() {
    $('.panel-group .panel-title').on('click', function() {
    var thisclick = $(this);
    var thebody = (window.opera) ? (document.compatMode == "CSS1Compat" ? $('html') : $('body')) : $('html,body'),
        thebodyscrollTop = thebody.scrollTop();

    thebody.stop().animate({
        scrollTop: thebodyscrollTop
    }, {
        duration: 500,
        easing: 'linear',
        step: function(now, fx) {
        fx.end = thisclick.parents('.panel').offset().top - 10; // 距離上方10px
        },
    });
    });
})
```