Click the element to jump to the specified position, use the anchor point, but do not change the URL path

Posted May 26, 20201 min read

  1. Now the effect is to click on the comment and jump to the comment position below the article
    image.png

  2. If you use the href attribute of the a tag, there will be a problem. When the page jumps out and the return button is used, the path becomes the path of the href.

\ == Solution:use scrollIntoView(true)

Add click event

<img src =" ../assets/images/career/com_icon.png "alt =" "@ click =" goCombtn ">

The selected id is to add an id = '#combtn' to the popular comment

 goCombtn() {
      document.querySelector("# combtn"). scrollIntoView(true);
    },