简体   繁体   中英

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. 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've seen this done with js, however I've never seen a specific example where tabs are involved.

Any help would be appreciated.

Thanks,

bigscreentv

you should use scrollto function

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;
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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