I have a div with is replaced upon certain user actions. These actions are performed under the div that is being replaced and in the case that the div is too large to fit completely into the view window, along with the buttons used to change it underneath, the browser will jump to the top of the newly loaded div. Which is annoying.
Does anyone know of a way to stop these? Cheers.
Here is the jQuery code. ChartContent is a small blob of html
function UpdateChartImage(ChartContent) {
//do updates on div here
var existingChart = $("#" + $(ChartContent).attr("id"));
existingChart.fadeOut("fast", function() { existingChart.replaceWith(ChartContent); }).fadeIn("fast");
}
Incidentally I have prevented the button from doing it's default behaviour so I don't think it's related to that.