【发布时间】:2019-06-23 08:31:45
【问题描述】:
我使用 scrollToFixed.js 滚动我的 div 并修复位置。但是当我在移动设备中看到页面时,我想在滚动到页面底部时删除位置修复。我该怎么做?我写了一些代码但它不能正常工作。
<div class="header" style='height:50px;border:1px solid;'></div>
<div class="container-fluid">
<div class="row">
<div class="col-md-3 col-sm-4">
<div class="profileRight" style='height:550px;border:1px solid;'>
name:Jack
</div>
</div>
<div class="col-md-9 col-sm-8 profile-info">
<div style='height:1550px;border:1px solid;'>
content</div>
</div>
</div>
</div>
$( '.profileRight' ).scrollToFixed( {
marginTop: $( '.header' ).outerHeight(),
limit: function () {
var limit = $( '.footer' ).offset().top-480;
return limit;
}
} );
$( document ).scroll( function () {
var winWidth = $( window ).width();
if ( winWidth < 767 ) {
$( '.profileRight' ).css( "position", "static" );
}
} );
【问题讨论】:
标签: javascript jquery twitter-bootstrap scroll fixed