div

js获取div基础元素

匿名 (未验证) 提交于 2019-12-03 00:11:01
1.js获取div元素 clientHeight 获取对象的高度,不计算任何边距、边框、滚动条,但包括该对象的补白。 clientLeft 获取 offsetLeft 属性和客户区域的实际左边之间的距离。 clientTop 获取 offsetTop 属性和客户区域的实际顶端之间的距离。 clientWidth 获取对象的宽度,不计算任何边距、边框、滚动条,但包括该对象的补白。 offsetHeight 获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度。 offsetLeft 获取对象相对于版面或由 offsetParent 属性指定的父坐标的计算左侧位置。 offsetParent 获取定义对象 offsetTop 和 offsetLeft 属性的容器对象的引用。 offsetTop 获取对象相对于版面或由 offsetTop 属性指定的父坐标的计算顶端位置。 offsetWidth 获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的宽度。 offsetX 设置或获取鼠标指针位置相对于触发事件的对象的 x 坐标。 offsetY 设置或获取鼠标指针位置相对于触发事件的对象的 y 坐标。 clientX , clientY 鼠标当前相对于网页的位置,当鼠标位于页面左上角时 clientX = 0 , clientY = 0

div固定显示的几种方法

匿名 (未验证) 提交于 2019-12-03 00:09:02
很多时候我们会受到一些需求: 1、div一直置顶 2、div一直置底 3、超过一定的位置之后div置顶 4、超过一定位置之后div置底 那么下面针对上面的几个问题写几个案例: 一、div一直在屏幕的上方,这个倒是容易咱们直接使用position:fixed;然后设置他的top值和left就可以了,别忘了设置宽度哦 <div class="top"> <div class="topf">跟单</div> </div> <style> .top,.topf{ height:100px; width:100%;} .topf{ position:fixed; top:0; left:0; background:#999; text-align:center; font-size:20px; color:#fff;} </style> 点击这里查看demo -》 二、这个跟上面的例子是一样的,我不不多说了 <div class="bottom"> <div class="bottomf">跟单</div> </div> <style> .bottom,.bottomf{ height:100px; width:100%;} .bottomf{ position:fixed; bottom:0; left:0; z-index:12; background:#999; text-align

Codeforces Round #576 (Div. 2)

匿名 (未验证) 提交于 2019-12-02 23:52:01
英语场,手速场。 题目链接:http://codeforces.com/contest/1199 A: O(n)扫一遍,对于每个a[i],往前扫x个往后扫y个完事。 1 /* basic header */ 2 #include <bits/stdc++.h> 3 /* define */ 4 #define ll long long 5 #define dou double 6 #define pb emplace_back 7 #define mp make_pair 8 #define sot(a,b) sort(a+1,a+1+b) 9 #define rep1(i,a,b) for(int i=a;i<=b;++i) 10 #define rep0(i,a,b) for(int i=a;i<b;++i) 11 #define eps 1e-8 12 #define int_inf 0x3f3f3f3f 13 #define ll_inf 0x7f7f7f7f7f7f7f7f 14 #define lson (curpos<<1) 15 #define rson (curpos<<1|1) 16 /* namespace */ 17 using namespace std; 18 /* header end */ 19 20 const int maxn = 1e5 +

水平多个div,超出出现横向滚动条;隐藏滚动条,但是依然可以滚动;

匿名 (未验证) 提交于 2019-12-02 23:49:02
1. 【问题】水平多个div块,超出外面div盒子后,水平出现横向滚动条? https://cn.vuejs.org/v2/guide/class-and-style.html      2. class和style的绑定的Vue源码分析:待定 2. 【问题】隐藏滚动条,但是依然要可以滚动?     c = a;     b = a+d;     其中b的用法:style="height: calc(100% + 8px);overflow: auto;" 部分使用代码: <div class="float-left normList"> <div style="height: calc(100% + 8px);overflow: auto;"> <div :style="'width:'+'76'*normList.length+'px;'"> <span class="active" v-for="(item,index) in normList" :key="index">指标{{ index }} </span> </div> </div> </div>

div自动滑动,鼠标移上停止滑动

匿名 (未验证) 提交于 2019-12-02 23:43:01
这是在做个人站的时候展示项目成果,因为不光需要展示,还需要介绍详细内容,就在滚动展示的地方做了这个效果以便于点开想要看的项目。 首先,要做的是一个需要滚动的区域。我前边写过一个关于图片循环滚动的示例,那个是一块块的的滚动==>实现图片的循环滚动. 这次我们就做滚动区域是平滑循环滚动效果。 下边是布局的HTML代码,原理是在要展示区域的div(.ban_img)里加一个能包含所有需要展示的图的大div(.in_img), <div class=" ban_img"> <div class="in_img"> <div class="inside inside1"></div> <div class="inside inside2"></div> <div class="inside inside3"></div> <div class="inside inside4"></div> <div class="inside inside5"></div> <div class="inside inside6"></div> <div class="inside inside1"></div> <div class="inside inside2"></div> <div class="inside inside3"></div> <div class="inside inside4"><

选择 body内的所有div元素

匿名 (未验证) 提交于 2019-12-02 23:42:01
1.基本选择器 复制代码 //选择 id为 one 的元素 $("#btn1").click(function() { $("#one").css(“background-color”, “red”); }); //选择 class 为 mini 的所有元素 $("#btn2").click(function() { $(".mini").css(“background-color”, “blue”); }); //选择 元素名是 div 的所有元素 $("#btn3").click(function() { $(“div”).css(“background-color”, “#ffeecc”); }); //选择 所有的元素 $("#btn4").click(function() { $("*").css(“background-color”, “#ff80ff”); }); //选择 所有的span元素和id为two的div元素 $("#btn5").click(function() { $(“span,#two”).css(“background-color”, “#ff0080”); }); 复制代码 2.层次选择器。 www.fx120.net/pfb/npx/gzxbyxb/57728.html 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Codeforces Round #479 (Div. 3) D. Divide by three, multiply by two

匿名 (未验证) 提交于 2019-12-02 23:40:02
传送门 D. Divide by three, multiply by two    给你一个数 x,x 可以执行以下两种操作中的一种得到数 y:      y 再执行上述两种操作的一种得到数 z;   接着对 z 得到......   这样依次执行了 n-1 次会得到 n 个数;   现在给你这 n 个数,让你按照上述规则给这 n 个数排序,使得其满足   a 1 =x , a 2 =y , a 3 =z , ........   输出这 n 个数;    对于任意一个数 x,能通过两种操作得到:     ①3x除以3     ②x/2乘2   你会发现,3x 与 x/2 不会同时出现,因为如果同时出现,为什么呢?   假设 3x 经过 i 次乘2操作,j次除以3的操作得到 x/2,即      因为GCD(2,3) = 1,所以右边的等式是不可能成立的;   所以 x 只能由①②中的一种情况得到;   并且这 n 个数各不相同;   那么,任意选取一个数,依次向前推,依次向后推即可得到答案; 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define ll long long 4 const int maxn=100+50; 5 6 int n; 7 ll a[maxn]; 8 map<ll ,bool>f; 9 10

Vue 指定 DIV 导出 PDF

匿名 (未验证) 提交于 2019-12-02 23:39:01
Vue项目, 将 DIV 以 PDF 的形式导出 1 <template> 2 <div class="btn" @click="downloadPdf">下载</div> 3 <div ref="pdf">我是一个要变为图片或PDF的div</div> 4 </template> 5 <script> 6 import html2canvas from 'html2canvas' 7 import jspdf from 'jspdf' 8 export default { 9 name: "printDiv", 10 data () { 11 return { 12 pdf: null 13 } 14 }, 15 methods: { 16 downloadPdf () { 17 let target = this.pdf 18 html2canvas(target, { 19 useCORS: true, // 当图片是链接地址时,需加该属性,否组无法显示图片 20 "imageTimeout": 0, 21 'scale': 2, 22 "width": 592, 23 "height": 841, 24 }) 25 .then(canvas => { 26 console.log(canvas) 27 let contentWidth = canvas.width; //

jq、js 动态循环100个div

匿名 (未验证) 提交于 2019-12-02 23:34:01
js: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>div100</title> <style> div{ width: 50px; height: 50px; border: 1px solid #DCDCDC; background: deeppink; position: absolute; left: 0; top: 0; font-size: 24px; color: white; font-weight: bold; text-align: center; line-height: 50px; } </style> <script> window.onload = function(){ var aDiv = document.getElementsByTagName('div'); var str = ""; for(var i = 0,j = 0;i<100;i++ ){ str += "<div>"+ i + "</div>"; } document.body.innerHTML = str; for(var i = 0;i<aDiv.length;i++){ aDiv[i].style.left = (i%10-1)*60 + "px"; if(i%10 == 0 && i!= 0){

DIV拖拽

匿名 (未验证) 提交于 2019-12-02 23:32:01
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> *{ margin: 0; padding: 0; } .box{ width: 100px; height: 100px; background-color: #FFF0F5; cursor:pointer; } </style> </head> <body> <div class="box"></div> </body> <script src="js/jquery-1.12.4.js"></script> <script> $(".box").on("mousedown",function (e){ console.log(e.pageX + "px" + e.pageY+"px"); var posi=$(this).offset(); var disX = e.pageX-posi.left; var disY = e.pageY-posi