I would like to do exactly what's done here: http://jsfiddle.net/cbp4N/17/
$('#cbxShowHide').click(function(){
if(this.checked) {
$('#block').show('fast',function() {
$(this).scrollTop($(this).data('scroll'));
});
}
else {
$('#block').data('scroll',$('#block').scrollTop());
$('#block').hide('fast');
}
});
Found in this post: Scroll position lost when hiding div
But on a div with an horizontal scroll. I've tried that http://jsfiddle.net/cbp4N/233/
$('#button').click(function() {
if ($('#block').is(':hidden')) {
$('#block').show("blind");
$('#block').scrollLeft($('#block').data('scroll'));
} else {
$('#block').data('scroll',$('#block').scrollLeft());
$('#block').hide("blind");
}
});
But it doesn't work…</p>
We can see the scroll reset before hiding and I would like to prevent that.