Page jumps to top when clicking new tab (jQuery Tabs) -


i using jquery tabs ajax.

html:

<div id="tabs">     <ul>         <li><a id='tab-1' href="/get-1.htm">1</a></li>         <li><a id='tab-2' href="/get-2.htm">2</a></li>         <li><a id='tab-3' href="/get-3.htm">3</a></li>     </ul> </div> 

jquery:

$( "#tabs" ).tabs({     beforeload: function( event, ui ) {         ui.jqxhr.error(function() {             ui.panel.html             (                 "bla bla bla";             );         });     } }); 

gif showing problem:

<!----------------------- image start ----------------------->

enter image description here

<!----------------------- image end ----------------------->

for more smoothier check link (select mp4): click me

i clicked 2nd tab, page jumped top. example:

<!----------------------- image start ----------------------->

enter image description here

<!----------------------- image end ----------------------->

more smoothier

note (2nd example) if opened tab earlier (was on 1st, pressed 2, jumped, pressed 1, no jump).

how can solve problem?

update

sad, example https://jqueryui.com/tabs/ working fine :( there no same bug.

when click on tab has less content current tab, overall height of page changes can affect scroll position of page. 1 way "fix" use heightstyle option , set "auto", i'm not entirely sure how going work ajax tabs.

http://api.jqueryui.com/tabs/#option-heightstyle

$( ".selector" ).tabs({ heightstyle: "fill" }); 

sample: http://jsfiddle.net/4uhjf/ click on tab one, scroll down until can't see h1, click on tab 2. because tab2 has far less content, height of page changes enough cause jump top. way around ensure content of tabs have similar height, or set height specific number , use scrolling larger height. heightstyle: "fill" best in case because can set height of parent element of tab container control height of ajax-loaded tabs.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -