When javascript-htmlahref is redirected to the anchor, how can I move it down?

Source: Internet
Author: User
Set & amp; lt; header & amp; gt; in html; that is to say, there is a small button on it (which should be common to our predecessors) that uses the aherf & quot; # id & quot; anchor for page shifting, however, clicking the link anchor will bring the page to "TOP", that is, some of them will be... settings in html
That is to say, there is a "small button" on it (which should be common to the predecessors)

Usea herf="#id"Click the link to take the page to the top of the page. That is to say, some of the pages are replaced by the header.
How can I move down some of the jump anchor points?

Similar to this
Http://segmentfault.com/q/1010000000124208

However, my p id is generated, and of course I have tried some js

$(function(){   if(location.hash){      var target = $(location.hash);      if(target.length==1){          var top = target.offset().top-100;          if(top > 0){              $('html,body').animate({scrollTop:top}, 1000);          }      }   } }); 

Big Solution

1201 modify hmtl as follows

  • My greatest region in the world
  • 36588 Systems
  • Other systems

My greatest region in the world

Reply content:

Settings in html


That is to say, there is a "small button" on it (which should be common to the predecessors)

Usea herf="#id"Click the link to take the page to the top of the page. That is to say, some of the pages are replaced by the header.
How can I move down some of the jump anchor points?

Similar to this
Http://segmentfault.com/q/1010000000124208

However, my p id is generated, and of course I have tried some js

$(function(){   if(location.hash){      var target = $(location.hash);      if(target.length==1){          var top = target.offset().top-100;          if(top > 0){              $('html,body').animate({scrollTop:top}, 1000);          }      }   } }); 

Big Solution

1201 modify hmtl as follows

  • My greatest region in the world
  • 36588 Systems
  • Other systems

My greatest region in the world

If you want to offset it to the following, you can only use js.

I checked the friend's method on the first floor and changed the style of his span tag,

.placeholder{display:block; width:100px; height:50px; margin-top:-50px; }

Js-free implementation.

Welcome.

Useposition:absolute;The method of discontinuing from the Document Stream changes the position of the anchor without affecting the presentation.

Http://jsbin.com/teqisuve/5/

PS. Adoption of updates downstairs

Do not jump to the element you want, set an empty element on it, jump to that

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.