page jump from div to an anchor

前端 未结 3 1673
隐瞒了意图╮
隐瞒了意图╮ 2020-12-17 15:19

I was trying to make a div jump from FAQ to a div id and could success easily, but since I have a fixed link to ju

相关标签:
3条回答
  • 2020-12-17 15:44

    I think then you have to add <a href="yourid">page place</a> inside your first div and have to give id to your anchor tag <a href="yourplace" id="idname"></a>

    0 讨论(0)
  • 2020-12-17 15:59

    As long as your anchor has an ID you can link to a location in your view by clicking the div you will just need some javascript.

    Setting the window.location.hash value will put the focus of the view on the selected ID.

    Sample

    <a href="#test1" id="back">Test</a>
    
    <div id="test1" onclick="window.location.hash='back'; ">
    

    JSFiddle Example

    0 讨论(0)
  • 2020-12-17 16:00

    if you have link to go another with variable you can use with id # sign

    <a href="product.php?action=edit#lastdiv>Go to Product Last Div</a>
    
    <div id="lastdiv">There are last product Exist</div>
    
    0 讨论(0)
提交回复
热议问题