好脑子不如烂笔头

看完之后及时的巩固和做好笔记,以后温习很方便
添加回到顶部按钮

获取览器显示区域的高度 : $(window).height();
获取浏览器显示区域的宽度 :$(window).width();
获取页面的文档高度 :$(document).height();
获取页面的文档宽度 :$(document).width();
获取滚动条到顶部的垂直高度 :$(document).scrollTop();
获取滚动条到左边的垂直宽度 :$(document).scrollLeft();

//监听滚动条滚动事件
  $(window).scroll( function() {
var WindowHeight=($(window).height());
var ScrollHeight=$(document).scrollTop();
if(WindowHeight<=ScrollHeight){
$('.top_img').removeClass('displayno');
}else{
$('.top_img').addClass('displayno');
}
} );
//设置锚点链接
//a1
<a href="#1F"></a>
//a2
<a href="" name="1F" id="1F">
点击a1会链接到a2的页面
在ci框架中在head中加上base_url的时候<base href='<?= base_url().'h5/treasure_v2/'?>'>
a的href的链接地址需要改成<?= site_url('/treasure/treasure_view')?>#1f(ps注意#1F书写的位置不要在>里面)





posted on 2017-03-06 16:22  tank&?  阅读(286)  评论(0编辑  收藏  举报