I thought this one was easy but I'm banging my head on the jumping part. I have a page, on this page I have tabs, I want to click on the 'read' link so that it (1) opens the tab and (2) jumps to that part of the page so user can keep reading. My code:
<a onclick="$('a[href=#tab-read]').click();">Read</a>
Like I said, works just fine, opens the tab I need but doesn't actually make the jump to it? I still have to scroll down the page to get to the content area.
尝试一下,您可以强制窗口转到锚标记,或将选择器向上更改以转到所需的元素:)
$(window).scrollTop($('a[href=#tab-read]').offset().top);
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.