Skip to content

Instantly share code, notes, and snippets.

@yoon
Created November 6, 2015 16:04
Show Gist options
  • Select an option

  • Save yoon/3c0adf18216f09219a27 to your computer and use it in GitHub Desktop.

Select an option

Save yoon/3c0adf18216f09219a27 to your computer and use it in GitHub Desktop.
jQuery script to repeatedly scroll through a mailchimp html email
var pageZoom = '.9';
var pixelsPerSecond = 10;
$('#awesomewrap').hide(); // hide email header
$('html').css('zoom', pageZoom); // zoom out the page
var scrollHeight = $(document).height() - $(window).height();
var scrollThrough = function(){
$('html, body').animate({scrollTop: 0}, 1).animate({ scrollTop: scrollHeight }, scrollHeight * 1000 / pixelsPerSecond, "linear", scrollThrough);
};
var stopScroll = function(){
$('html, body').stop();
};
scrollThrough();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment