I am using code I got from this page - Flip div with two sides of html and am trying to have the div that spins around scroll to the top slowly as it spins. (side 2) This is what I am currently trying from this page.
$('#back').click(function (e) { //#A_ID is an example. Use the id of your Anchor
$('html, body').animate({
scrollTop: $('#side-2').offset().top - 20 //#DIV_ID is an example. Use the id of your destination on the page
}, 'slow');
});
and this is the flip code I am using:
document.getElementById( 'back' ).addEventListener( 'click', function( event ) {
event.preventDefault();
document.getElementById( 'side-2' ).className = 'flip flip-side-1';
document.getElementById( 'side-1' ).className = 'flip flip-side-2';
}, false );
document.getElementById( 'front' ).addEventListener( 'click', function( event ) {
event.preventDefault();
document.getElementById( 'side-2' ).className = 'flip';
document.getElementById( 'side-1' ).className = 'flip';
}, false );
I have tried various code I have found here on SO and elsewhere using scrollTop but I can't seem to dial it in.