var fScrollTopHeight = function(){
return document.documentElement&&document.documentElement.scrollTop || document.body && document.body.scrollTop || 0;
};
var fClientHeight = function(){
var clientHeight=0;
if(document.body.clientHeight&&document.documentElement.clientHeight){
clientHeight = (document.body.clientHeight<document.documentElement.clientHeight)?document.body.clientHeight:document.documentElement.clientHeight;
}else{
clientHeight = (document.body.clientHeight>document.documentElement.clientHeight)?document.body.clientHeight:document.documentElement.clientHeight;
}
return clientHeight;
};
var fBodyHeight = function(){
return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
};
$(function(){
var fixedbar = document.getElementById("fixedbar");
// jScShow = $('<div style="position:fixed;bottom:100px;right:0;z-index:999;background:red;width:120px;height:100px;">5555</div>').appendTo('body');
$(document).on('scroll', function(){
// alert(1);
// jScShow.html([fScrollTopHeight(), fClientHeight(), fBodyHeight()].join('<BR /><BR />') + '<BR />');

// if(fScrollTopHeight()+fClientHeight()- fBodyHeight() >= -10){//最底部

// }

var items = $("#wrapper").find('.ui-coll-list');
var currentText = "";
items.each(function(){
var m = $(this);
if (fScrollTopHeight() > m.offset().top - 86) {
currentText = m.find('.head').text();
}else{
return false
}
});
if (currentText) {
fixedbar.innerHTML = currentText;
};

if (fScrollTopHeight() > 5) {
fixedbar.style.display="block";
}else{
fixedbar.style.display="none";
}
});
})

scroll的更多相关文章

  1. 【前端性能】高性能滚动 scroll 及页面渲染优化

    最近在研究页面渲染及web动画的性能问题,以及拜读<CSS SECRET>(CSS揭秘)这本大作. 本文主要想谈谈页面优化之滚动优化. 主要内容包括了为何需要优化滚动事件,滚动与页面渲染的 ...

  2. MUI开发APP,scroll组件,运用到区域滚动

    最近在开发APP的过程中,遇到一个问题,就是内容有一个固定的头部和底部.         头部就是我们常用的header了,底部的话,就放置一个button,用来提交页面数据或者进入下一个页面等,效果 ...

  3. 完美解决,浏览器下拉显示网址问题 | 完美解决,使用原生 scroll 写下拉刷新

    在 web 开发过程中我们经常遇到,不想让用户下拉看到我的地址,也有时候在 div 中没有惯性滚动,就此也出了 iScroll 这种关于滚动条的框架,但是就为了一个体验去使用一个框架好像又不值得,今天 ...

  4. offset、client、scroll开头的属性归纳总结

    HTML元素有几个offset.client.scroll开头的属性,总是让人摸不着头脑.在书中看到记下来,分享给需要的小伙伴.主要是以下几个属性: 第一组:offsetWidth,offsetHei ...

  5. mui scroll和上拉加载/下拉刷新

    mui中 scroll和上拉加载/下拉刷新同时存在会出现两个滚动条 把/*   */ /* //mui页面鼠标拖动代码: mui('.mui-scroll-wrapper').scroll({ dec ...

  6. JavaScript学习笔记5 之 计时器 & scroll、offset、client系列属性 & 图片无缝滚动

    一.计时器 setInterval ( 函数/名称 , 毫秒数 )表示每经过一定的毫秒后,执行一次相应的函数(重复) setTimeout ( 函数/名称 , 毫秒数 ) 表示经过一定的毫秒后,只执行 ...

  7. JavaScript中的 offset, client,scroll

    在js 中我们要用到的 offset, client, scroll 在这我把自己理解的给大家分享一下. offset div.offsetTop 指div距离上方或上层控件的距离,单位像素 div. ...

  8. 【前端性能】高性能滚动 scroll 及页面渲染优化--转发

    本文主要想谈谈页面优化之滚动优化. 主要内容包括了为何需要优化滚动事件,滚动与页面渲染的关系,节流与防抖,pointer-events:none 优化滚动.因为本文涉及了很多很多基础,可以对照上面的知 ...

  9. 由overflow-x:scroll产生的收获

    我们都知道float:left属性会让元素向左浮动,如果用一个div将几个左浮动的li包起来,是不是div的宽度被li撑得很长很长呢,代码: <!DOCTYPE html> <htm ...

  10. UGUI 之Scroll Rect 坑

    由于UGUI没有提供类似Scroll View类似的控件,但提供了ScrollRect主机.可以自定义Scroll View 同时提供了Mask组件来遮罩超出Scroll Rect对象的范围, 之所以 ...

随机推荐

  1. Floating-Info---Android

    https://github.com/alt236/Floating-Info---Android    

  2. Android开发环境中的概念和工具介绍

    最近学习Android开发,以前使用C/C++多一些,现在再补点Java知识,不管是哪种语言,都不过是一种工具而已,真的学起来,大同小异,无谓优劣.学习Android编程肯定是要先从环境搭建开始,无论 ...

  3. LayoutInflater

    Android中LayoutInflater的使用 博客分类: Android   Inflater英文意思是膨胀,在Android中应该是扩展的意思吧. LayoutInflater的作用类似于 f ...

  4. java_spring_bean的作用域_实例是否为单实例

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  5. C# for AUTOCAD ActiveX获取图形对象坐标程序

    C# for AUTOCAD ActiveX获取图形对象坐标程序 using System;using System.Collections.Generic;using System.Componen ...

  6. 关于JFace中的输入值(InputDialog)对话框类

    格式: InputDialog(Shell parentShell, String dialogTitle, String dialogMessage, String initialValue, In ...

  7. php gd 生成日历图

    <?php //如果您提交了时间则显示您提交年月的日历,否则显示当前月份日历 if (isset($_GET['month']) && isset($_GET['year'])) ...

  8. akka创建actor时报错:IllegalArgumentException: no matching constructor found on class $iwC$$iwC$$iwC$$iwC$

    在spark-shell中输入范例中的代码: import akka.actor.Actor import akka.actor.Props import akka.event.Logging cla ...

  9. 支持BLOB操作的Jena框架扩展——JenaBLOB

    与研究语义网的同行们分享一下上半年做的一个东西,它是支持BLOB操作的Jena框架扩展--JenaBLOB,已在GitHub上开源,欢迎提出宝贵意见! 众所周知,Jena是不支持BLOB类型的Lite ...

  10. java--简单排序算法

    1.冒泡排序 排序原理: 过程简单,首先将第一个记录的关键字和第二个记录的关键字进行比较,若为逆序,则将两个记录交换,然后比较第二个记录与第三个记录得关键字.以此类推,直至第n-1个记录和第n个记录的 ...