//回到顶部
$(function() {
$.fn.backToTop = function(options) {
var defaults = {
showHeight : 120,
speed : 100
};
var options = $.extend(defaults, options);
$("#footer").append("<div id='totop' style='cursor:pointer;position:fixed;bottom:20px;right:10px;z-index:9999;width:30px;height:30px;background-color:#000;'><a>返回</a></div>");
var $toTop = $(this);
var $top = $("#totop");
var $ta = $("#totop a");
$toTop.scroll(function(){
var scrolltop=$(this).scrollTop();
if(scrolltop>=options.showHeight){
$top.show();
}
else{
$top.hide();
}
});
$ta.hover(function(){
$(this).addClass("cur");
},function(){
$(this).removeClass("cur");
});
$top.click(function(){
$("html,body").animate({scrollTop: 0}, options.speed);
});
}