The context specification seems to fix the problem:
$('body, html', parent.document).animate({ scrollTop: 0 },1500);
iOS, iOS :
var iOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false );
$(document).on('click touchstart', '.backtotop', function() {
if (iOS) {
$('html, body', parent.document).animate({ scrollTop: $("body").offset().top},1500,"easeOutQuart");
} else {
$('html, body').animate({ scrollTop: $("body").offset().top},1500,"easeOutQuart");
}
});
-, parent.document. parent.window .