问题:它滚动到底部而不是section2。也许scrollTop不是这样做的?我不确定。
https://jsfiddle.net/ocoeabmy/5/
CODE (website not phone friendly)
#include <stdio.h>
#define PI 3.141593
int main (){
int degrees =10;
double radians;
printf("Degrees to Radians \n");
while( degrees <= 360){
radians = degrees*PI/180;
printf("%6i %9.6f \n", degrees, radians);
degrees +=10;
}
}
END CODE
答案 0 :(得分:0)
您可以使用此功能
function ScrollWindowToElement(ele) {
var sc = $(ele[0]).offset().top;
$('body,html').animate({
scrollTop: (sc - 30)
},
'slow');
}
答案 1 :(得分:-1)
试试这个:
您可以从jquery函数中删除700
var target = $("#section2");
$('#myPanel').animate({
scrollTop: target.offset().top -100
}, );
//window.location.hash = "#" + "section3";