day29-JS基础5

  1. 获取可视区的宽度和高度
    获取宽高的时候,要看有没有DTD的说明,如果有,使用documentElement,如果没有,使用body
var clientWidth = document.documentElement.clientWidth
var clientHeight = document.documentElement.clientHeight
  1. 吸顶条
    可以直接获取到div的宽度和高度,而且是不带px, 并且样式无论在哪都可以获取到,这两个属性是只读属性
    offsetWidth
    offsetHeight
    可以直接获取到div的距离浏览器上边的距离和距离浏览器左边的距离,而且是不带px, 并且样式无论在哪都可以获取到,这两个属性是只读属性
    offsetTop
    offsetLeft
  2. jquery
    jquery是什么?
    jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.
    jQuery是一个快速、小型、功能丰富的JavaScript库。它使HTML文档遍历和操作、事件处理、动画和Ajax等工作变得更加简单,并且具有在多个浏览器之间工作的易于使用的API。结合了通用性和可扩展性,jQuery改变了数百万人编写JavaScript的方式。
    版本要求:看版本.txt
    压缩和非压缩
    .min.js : 压缩版本,一行代码,没有了空格、缩进等
    .js : 非压缩版本,正常的代码查看
    使用方式
    可以本地使用

    可以引入网络文件使用

    选择器
    jquery通过选择器就可以找到指定的节点
    id、class、标签、层级
    基本
    :first 第一个
    :last 最后一个
    :even 偶数下标
    :odd 奇数下标
    :eq() 等于哪个下标
    :gt() 大于哪个下标
    :lt() 小于哪个下标

你可能感兴趣的:(day29-JS基础5)