简体   繁体   English

iframe使用标签页滚动到页面顶部

[英]Iframe Scroll to top of page on load with tabs

I have an i-frame of a "design your own uniform" app within a page. 我在页面中有一个“设计自己的制服”应用程序的i框架。 The design your own uniform app consists of four tabs (select product, select colours, insert details, receive quote). 您自己的统一应用程序的设计包含四个选项卡(选择产品,选择颜色,插入详细信息,接收报价)。

Each time I go to a new tab the page stays at the same horizontal position as the previous tab. 每次我转到新标签页时,页面都与上一个标签页保持相同的水平位置。 Is there a way that I can make the page load at the top of the i-frame from tab to tab? 有没有一种方法可以使页面在选项卡之间的i框架顶部加载?

I've seen this done with js, however I've never seen a specific example where tabs are involved. 我已经看到用js完成此操作,但是我从未见过涉及标签的特定示例。

Any help would be appreciated. 任何帮助,将不胜感激。

Thanks, 谢谢,

bigscreentv 大屏幕电视

you should use scrollto function 你应该使用scrollto功能

html html

    <a href='#id'>btn</a>
    <div id='id'></div>

$('a').click(function() {
    var elementClicked = $(this).attr("href");
    var destination = $(elementClicked).offset().top;
    $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-15}, 500 );
    return false;
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM