jquery——尺寸
1. 获取和设置元素的尺寸

2. 获取元素相对页面的绝对位置:offset()
这种方式增加的盒子不会对之前的结构产生影响
demo:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>手风琴</title>
<script type="text/javascript" src="jquery-1.12.4.min.js"></script>
<script type="text/javascript"> $(function () {
var $pos = $('.pos');
var pos = $pos.offset(); var w = $pos.outerWidth();
// alert(pos.left);
// console.log(pos);
$('.pop').css({left:pos.left+w,top:pos.top}); $pos.mouseover(function () {
$('.pop').show();
}); $pos.mouseout(function () {
$('.pop').hide();
});
})
</script>
<style type="text/css"> .box{
width:100px;
height:100px;
background-color: hotpink;
margin-bottom: 10px;
} .pos{
margin-left:500px; } .pop{
width:100px;
height:100px;
background-color: gold;
position:fixed;
left:0;
top:0;
display: none;
}
</style>
</head>
<body>
<div class="box"></div>
<div class="box"></div>
<div class="box pos"></div>
<div class="box"></div>
<div class="pop">提示信息</div>
</body>
</html>
3. $(window).height(): 获取可视区的高度(桌面显示的一个窗口的大小)
4. $(document).height(): 获取页面高度
5. $(document).scrollTop();$(document).scrollLeft(): 获取页面滚动距离

jquery——尺寸的更多相关文章
- 实现文字自动横移--- jquery尺寸相关函数
		
效果图: 一实现文字自动横移 <style type="text/css"> #demo {overflow:scroll;width:740px; } #indemo ...
 - jQuery 基础(4)jQuery 尺寸
		
jQuery 尺寸方法jQuery 提供多个处理尺寸的重要方法:width()height()innerWidth()innerHeight()outerWidth()outerHeight()jQu ...
 - jQuery  尺寸
		
通过 jQuery,很容易处理元素和浏览器窗口的尺寸. jQuery 尺寸 方法 jQuery 提供多个处理尺寸的重要方法: width() height() innerWidth() innerHe ...
 - 关于jquery尺寸的总结
		
以前总是对jquery的尺寸稀里糊涂,有需要的可以看下下面的代码: ①页面布局如下: <!doctype html> <html> <head> <meta ...
 - jquery尺寸和jQuery设置和获取内容方法
		
一.jquery尺寸 jQuery 提供多个处理尺寸的重要方法: width() 设置或返回元素的宽度(不包括内边距.边框或外边距),括号中可填数值宽度参数,无单位 height() 设置或 ...
 - jQuery尺寸
		
jQuery 尺寸 jQuery width() 和 height() 方法 width() 方法设置或返回元素的宽度(不包括内边距.边框或外边距). height() 方法设置或返回元素的高度(不包 ...
 - jQuery尺寸算法
		
我们默认都统一是采用offsetWidth或者offsetHeight取值了,但我们知道关于这2个尺寸的算法是这样的: offsetWidth = border-left-width + paddin ...
 - 图解JQUERY尺寸及位置定义
		
最近在学习JQUERY的一些应用,接触到了JQUERY对于元素尺寸及位置定义,还有就是配合浏览器尺 寸及状态的计算所做出的一些动画特效.其实像这类JQUERY应用无外乎涉及这些属性的调用:innerH ...
 - jQuery 尺寸 方法
		
jQuery 提供多个处理尺寸的重要方法: width() height() innerWidth() innerHeight() outerWidth() outerHeight()
 
随机推荐
- androidpn环境搭建
			
1.下载androidpn版本.http://sourceforge.net/projects/androidpn/postdownload?source=dlp 2.下载安装tomcat 2.1 下 ...
 - java blob 文件上传下载
			
1.文件上传 pojo中为byte[] 类型,数据库中对应为blob类型. 主要代码: FileInputStream fis = null; fis = new FileInputStream(ne ...
 - elasticsearch 复合查询
			
常用查询 固定分数查询 127.0.0.1/_search(全文搜索) { "query":{ "match"{ "title":" ...
 - 杭电acm 1098题
			
Problem Description Ignatius is poor at math,he falls across a puzzle problem,so he has no choice bu ...
 - p3627&bzoj1179 抢掠计划(ATM)
			
传送门(洛谷) 传送门(bzoj) 题目 Siruseri 城中的道路都是单向的.不同的道路由路口连接.按照法律的规定, 在每个路口都设立了一个 Siruser i 银行的 ATM 取款机.令人奇怪的 ...
 - iObjects for java +weblogic
 - linux 的有用的网站
			
从windows下移到linux下还有很长的路走阿,慢慢记录一些有用的网站吧 http://www.yolinux.com/ http://linux.die.net/
 - JsonParse类
			
using System.Data; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System; using Syst ...
 - Black Beauty
			
Chapter 1 My Early Home While I was young, I live upon my mother's milk, as I could not eat grass. W ...
 - Ocelot(二)- 请求聚合与负载均衡
			
Ocelot(二)- 请求聚合与负载均衡 作者:markjiang7m2 原文地址:https://www.cnblogs.com/markjiang7m2/p/10865511.html 源码地址: ...