$(function(){
//返回顶部
$('.btop').hover(function(){
$(this).find('img').attr('src','${base!}/${img_path!}/backtop2.gif');
},function(){
$(this).find('img').attr('src','${base!}/${img_path!}/backtop1.gif');
});
window.onscroll = function(){
var scrT = document.documentElement.scrollTop || document.body.scrollTop;
if(scrT > 0){
$('.btop').show();
}else {
$('.btop').hide();
};
};
$('.btop').click(function(){
document.documentElement.scrollTop = document.body.scrollTop = 0;
$('.btop').hide();
});
})
<!--返回顶部 开始-->
<a href="javascript:void(0)" class="btop"><img src="${base!}/${img_path!}/backtop1.gif" /></a>
<!--返回顶部 结束-->