de29d84e72a13d9d2a90d0d7ba1862a544a082a8 tdreszer Wed Jan 22 16:43:08 2014 -0800 Scrool the page back to the top on 'refresh' as requested by Bob during #709 review. diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 514edb2..afa0846 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -3303,30 +3303,31 @@ genomePos.set(decodeURIComponent(prevPos)); imageV2.navigateInPlace("position=" + prevPos, null, false); } }); // TODO: move elsewhere? // With history support it is best that most position changes will ajax-update the image // This ensures that the 'go' and 'refresh' button will do so unless the chrom changes. $("input[value='go'],input[value='refresh']").click(function () { var newPos = genomePos.get().replace(/,/g,''); var newChrom = newPos.split(':')[0]; var oldChrom = genomePos.getOriginalPos().split(':')[0]; if (newChrom == oldChrom) { imageV2.markAsDirtyPage(); imageV2.navigateInPlace("position="+encodeURIComponent(newPos), null, false); + window.scrollTo(0,0); return false; } return true; }); // Have vis box changes update cart through ajax. This helps keep page/cart in sync. vis.initForAjax(); // We reach here from these possible paths: // A) Forward: Full page retrieval: hgTracks is first navigated to (or chrom change) // B) Back-button past a full retrieval (B in: ->A,->b,->c(full page),->d,<-c,<-B(again)) // B1) Dirty page: at least one non-position change (e.g. 1 track vis changed in b) // B2) Clean page: only position changes from A->b->| var curPos = encodeURIComponent(genomePos.get().replace(/,/g,'')); var cachedPos = imageV2.history.getState().data.position; // A) Forward: Full page retrieval: hgTracks is first navigated to (or chrom change)