'use strict';
(function ($){
$.fn.backToTop=function (offset, scrollDuration){
var $this=$(this);
var showHideButton=function (){
if($(document).scrollTop() > offset){
$this.addClass('btn__visible');
}else{
$this.removeClass('btn__visible');
}};
showHideButton();
$(document).scroll(function (){
showHideButton();
});
$this.on('click', function (event){
event.preventDefault();
$('body,html').animate({scrollTop: 0}, scrollDuration);
});
return this;
};
$(document).ready(function (){
$('.btn-back-to-top').backToTop(300, 700);
});
})(jQuery);