我有一個固定的位置頁腳,從jquery函數獲取它的頂部位置。使用航點時,當我向下滾動時,#main是'bottom-in-view',我無法改變頁腳的高度。有人有主意嗎?最終,這需要向下滑動並顯示更多的頁腳內容。 here is the fiddle是否有固定位置元素的動畫高度?問題與jQuery和waypoints.js改變高度
這裏是jQuery代碼:
$(function(){
var position = function() {
var w = $(window).height();
var f = $('footer').height();
var foo = (w-f);
$('footer').css('top', foo);
};
$(document).ready(position);
$(window).resize(position);
if (screen.width >= 768){
$('#main').waypoint(function(direction) {
if (direction === 'down') {
$('footer').css({'height': "500px"});
alert('hit rock bottom');
}
}, { offset: 'bottom-in-view' })
.waypoint(function(direction){
if (direction === 'up') {
//$('footer').animate({height:'110px'},300);
}
}, { offset: 'bottom-in-view' });
}
});
你不需要用$(function(){})第二次附上你的jquery函數。 – 2013-05-08 03:43:43
是的。被拼接在一起大塊,忘了刪除 – 2013-05-08 19:15:52