如何在 window.resize 之后获取当前高度的值?
$(window).resize(function(){
currHeight = $('#window-fixed').height();
});
console.log( currHeight );
//Uncaught ReferenceError: currHeight is not defined
$('a.stp').click(function(e){
e.preventDefault();
var href = $(this).data('id');
$('html, body').animate({
scrollTop: ( $(href).offset().top ) - currHeight
}, 1200);
});
谢谢