javascript - How to set the initial position of overflow scroll?
phpcn_u15822017-05-19 10:16:30
0
2
776
Usetop: 50%; transform: translateY(-50%)Vertically centered p When the height of p is greater than the parent container, the initial position of the scroll is not the top of the p Similar to this, please give me some advice. .
$('body').scrollTop(‘(current center element height - container height)/2’); Remember to add if height is not greater than the judgment