Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I fixed this myself by using the <a href="https://github.com/carhartl/jquery-cookie" rel="nofollow">jquery-cookie</a> plugin - now it returns to the exact same vertical position as were I left it last.</p> <p>When clicking a line in the list (in tab one), I save the position to a cookie and once clicking on tab one, it will fetch the old position from the cookie and scroll down to it.</p> <p>I replaced this code:</p> <pre><code>$(".edit").click(function (e) { e.preventDefault(); // prevent the window/page to jump to the top // Change focus to tab "two" (0-based index so this is the 2nd tab) $("#tabsMain").tabs("option", "active", 1); </code></pre> <p>.. with this code (I just added the cookie part - didn't change/delete anything):</p> <pre><code>$(".edit").click(function (e) { e.preventDefault(); // prevent the window/page to jump to the top // Set a cookie named "scrollPos" which lives for 7 days var scrollPos = $(window).scrollTop(); $.cookie("scrollPos", scrollPos, { path: '/', expires: 7 }); // Change focus to tab "two" (0-based index so this is the 2nd tab) $("#tabsMain").tabs("option", "active", 1); </code></pre> <p>Note that the "e.preventDefault()" can be deleted too - it doesn't do any good in here I have found out.</p> <p>And I also replaced this:</p> <pre><code>$("#tab_one").click(function (event) { if (oldTabIndex == 1) { if ($("#selectedRow").length &gt; 0) { $('html, body').animate({ scrollTop: $("#selectedRow").offset().top }, 500); } } }); </code></pre> <p>.. with this:</p> <pre><code>$("#tab_one").click(function (event) { if (oldTabIndex == 1) { var scrollPos = $.cookie("scrollPos"); // get the "scrollPos" cookie $('html, body').animate({ scrollTop: scrollPos }, 500); } }); </code></pre> <p>I cannot get the Fiddle demo to include the jquery-cookie plugin(?) :-/</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload