jQuery-平滑滚动更改锚点

时间:2018-12-06 08:56:30

标签: jquery

我正在使用jQuery更改没有标签的URL#anchor。 在表格中具有ID的ID,该标签会更改其锚点, 但这不适用于平滑滚动。

我只想更改URL而无需点击

有人可以帮助我吗?

下面是我的html

<div class="content-wrapper">
<section class="content container-fluid">
    <div class="box-body">
        <table class="table table-bordered table-striped dataTable" role="grid" aria-describedby="example1_info" id="anchor_1">
            <tbody>
            <tr role="row" class="odd">
                <td class="text-center">1</td>
                <td class="text-center">2</td>
                <td class="text-center">3</td>
                <td class="text-center">4</td>
            </tr>
            <tr role="row" class="odd">
                <td class="text-center">1</td>
                <td class="text-center">2</td>
                <td class="text-center">3</td>
                <td class="text-center">4</td>
                <td class="text-center">
                <div class="section-row" style="display:inline-flex">
                    <button type="submit" class="btn btn-primary btn-xs angle-up item-up">
                        <i class="fa fa-angle-up" aria-hidden="true"></i>
                    </button>
                    <button type="submit" class="btn btn-primary btn-xs angle-down item-down">
                        <i class="fa fa-angle-down" aria-hidden="true"></i>
                    </button>
                    </div>
                </td>
                </tr>
            </tbody>                    
            </table>
</section> 

<section class="content container-fluid">
    <div class="box-body">
        <table class="table table-bordered table-striped dataTable" role="grid" aria-describedby="example1_info" id="anchor_2">
            <tbody>
                <tr role="row" class="odd">
                <td class="text-center">1</td>
                <td class="text-center">2</td>
                <td class="text-center">3</td>
                <td class="text-center">4</td>
                <td class="text-center">
                <div class="section-row" style="display:inline-flex">
                    <button type="submit" class="btn btn-primary btn-xs angle-up item-up">
                        <i class="fa fa-angle-up" aria-hidden="true"></i>
                    </button>
                    <button type="submit" class="btn btn-primary btn-xs angle-down item-down">
                        <i class="fa fa-angle-down" aria-hidden="true"></i>
                    </button>
                    </div>
                </td>
                </tr>
            </tbody>                    
        </table>
        </div>
</section>  

0 个答案:

没有答案