scrolltop

去到底部、回到顶部css当网页向下滑动 20px 出现"返回顶部" 按钮

心已入冬 提交于 2019-11-30 00:56:58
html <div> <button onclick="returnTop()" id="btnTop" title="返回顶部">返回顶部</button> <button onclick="returnBottom()" id="btnBottom" title="去到底部">去到底部</button> </div> 样式 #btnTop { display: none; position: fixed; bottom: 20px; right: 30px; z-index: 99; border: none; outline: none; background-color: #89cff0; color: white; cursor: pointer; padding: 15px; border-radius: 10px; } #btnTop:hover { background-color: #1E90FF; } #btnBottom { display: none; position: fixed; bottom: 100px; right: 30px; z-index: 99; border: none; outline: none; background-color: #89cff0; color: white; cursor: pointer; padding:

模拟双击事件以及图片放大基点问题

这一生的挚爱 提交于 2019-11-30 00:07:42
1 <template> 2 <div> 3 <transition name="maskTransition"> 4 <div class="alert" v-show="showValue" @click="handleShowValue()"> 5 <span class="iconfont icon"></span> 6 </div> 7 </transition> 8 <transition name="dialogTransition"> 9 <div class="dialog" v-show="showValue"> 10 <div class="img-box" ref="ImgBox"> 11 <div class="event" :style="'width:' + width + '%;'" @click.self.stop="amplification($event)"> 12 <img :src="imgUrl" alt=""> 13 </div> 14 </div> 15 </div> 16 </transition> 17 </div> 18 </template> 19 20 <script> 21 import { clicking } from '../../common/isdbclick' 22 23 export default {

How to scroll to top of a div using jQuery?

爷,独闯天下 提交于 2019-11-29 21:15:46
I have a gridview inside a div.. I want to scroll to top of the div from the bottom of the div using jquery.. Any suggestion.. <div id="GridDiv"> // gridview inside.. </div> My gridview will have custom pagination generated link buttons in it... I will scroll to top of the div from the bottom of the link button click ... protected void Nav_OnClick(object sender, CommandEventArgs e) { LinkButton lb1 = (LinkButton)sender; //string s = lb1.ID; ScriptManager.RegisterClientScriptBlock(lb1, typeof(LinkButton), "scroll", "javascript:document.getElementById('GridDiv').scrollTop = 0;", true); In the

Angular 5 Scroll to top on every Route click

一世执手 提交于 2019-11-29 19:50:32
I am using angular 5. I have a dashboard where I have few sections with small content and few sections with so large content that I am facing a problem when changing router while going to top. Every time I need to scroll to go to top. Can anyone help me to solve this issue so that when I change the router my view always stay at the top. Thanks in advance. A router outlet will emit an activate event any time a new component is being instantiated, so (activate) event could be to scroll (for example) to the top: app.component.html <router-outlet (activate)="onActivate($event)" ></router-outlet>

小火箭返回顶部

萝らか妹 提交于 2019-11-29 18:56:59
布局: <p>返回顶部</p> div. actGotop > a 案例分析: 1,页面滚动, 当超出去1000px 的时候 , 小火箭会渐渐的显示出来( fadeIn) , 如果小于1000,就让小火箭隐藏. 2, 小火箭作为背景图片 (gotop.png) 放在 a 中, 当鼠标移动到 a 链接的上方 ( a:hover ) 时, a 的背景图片变成 gotop.gif 形式. 3,点击小火箭, 页面会慢慢的返回到顶部 关键代码: .actGotop a , .actGotop a:link{ width :150px; height:195px; display: inline-block; background: url (images / gotop.png) no-repeat; outline:none; } .actGotop a:hover{ width:150px; height:195px; background: url (images / gotop.gif) no-repeat; outline: none; } jQuery代码: $(window).scroll(function(){ if($(window).scrollTop >= 1000) { $(".actGotop").stop().fadeIn(1000); } else { $("

jQuery window.scroll move div vertical in opposite direction

夙愿已清 提交于 2019-11-29 17:43:57
I have a div that scrolls down on the page scroll and when I scroll up the div scrolls up. I would like the opposite This is the code: // SCROLL BUTTON // -- iPhone picture should scroll in when down and down when up jQuery(window).scroll(function(){ jQuery(".iphonepic").stop().animate({ "top": (jQuery(window).scrollTop() - 0.00) + "px"}, "slow"); }); So when you scroll down, the div should go up vertically not the same as the scroll direction. Fiddle demo: http://jsfiddle.net/khaleelm/sQZ9G/7/ Update I also want to limit the DIV not to go higher than -150px, trying if ( parseInt(jQuery("

el-select数据过多懒加载(loadmore)

喜你入骨 提交于 2019-11-29 16:46:25
el-select数据过多处理方式 在日常项目中 el-select 组件的使用频率是非常之高的. 当数据过多时渲染时间非常长, 这里提供几个处理方式. 远程搜索 组件提供了远程搜索方式, 也就是按照你输入的结果匹配选项. 官网提供了 参考示例 ; 这里不加赘述. 下拉懒加载loadMore 下拉懒加载, 当select滚动到底部时, 你再去请求一部分数据, 加入到当前数据中. 某组件中: <template> <el-select v-model="value" placeholder="请选择" filterable multiple v-el-select-loadmore="loadmore" > <el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.id"> </el-option> </el-select> </template> export default { directives: { 'el-select-loadmore': { bind(el, binding) { // 获取element-ui定义好的scroll盒子 const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown .el

JavaScript/JQuery 宽高的理解和应用

一笑奈何 提交于 2019-11-29 16:45:33
以下为个人认为有必要记录的笔记 不喜勿喷 js相关宽高介绍 window对象和document对象的介绍 window对象和document对象的location属性 与 window对象相关的宽高: window对象的 screen属性 与 document 相关的宽高: document对象中与 client 相关的宽高 document对象中与 offset 相关的宽高 document对象中与 scroll 相关的宽高 documentElement和body的关系 Event对象的各种坐标 clientX,clientY screenX,screenY offsetX,offsetY pageX,pageY X,Y js各种宽高的应用 可视区域加载 网页滚动到底部或者顶部的加载 div滚动到底部的加载 jq相关宽高介绍 内容宽高: 内容+padding宽高 内容+padding+border宽高 其他宽高相关 .scrollLeft() .scrollTop() .offset() .position() js相关宽高介绍 window对象和document对象的介绍 window对象 表示浏览器中打开的窗口。 可以省略。 document对象 是window对象的一部分。 window对象去掉浏览器上部的菜单栏。 HTML文档成为 document 的对象。

前端 PC端兼容性问题总结

巧了我就是萌 提交于 2019-11-29 16:37:43
1.如果图片加a标签在IE9-中会有边框   解决方案: img{border:none;} 2.rgba不支持IE8   解决方案:可以用 opacity    eg: opacity:0.7; /* FF chrome safari opera */ filter:alpha(opacity:70); /* 用了ie滤镜,可以兼容ie */  但是,需要注意的是,opacity会影响里面元素的透明度 3. display:inline-block ie6/7不支持   解决方案: display:inline-block; *display:inline; 4.默认的body没有body去掉margin情况下ie5、6、7边缘会很宽margin-top加倍 如果处于无声明状态那么所有的ie浏览器margin-top加倍   解决方案:用css给body添加magin属性为0px body{margin:0;} 5.IE 6.0 Firefox Opera等是 真实宽度=width padding border  IE5.X 真实宽度=width   解决方案:   方法1. div.content {   width : 400px ; //这个是错误的width(对于ie5来说是正确的),所有浏览器都读到了   voice-family : "\" } \""; //IE5

固定导航栏

有些话、适合烂在心里 提交于 2019-11-29 14:01:09
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>固定导航栏</title> <style type="text/css"> * { margin: 0; padding: 0; } .top, .nav { width: 1423px; margin: 0 auto; } .main { width: 1000px; margin: 10px auto; } img { display: block; vertical-align: middle; } </style> <script src="jquery-1.12.4.js"></script> <script> $(function () { //思路:给页面设置一个滚动事件,时刻监视页面的scrollTop的值, // 如果这个值大于第一部分的高度,就设置第二部分为固定定位. // 如果这个值小于第一部分的高度,就设置第二部分的定位还原. //获取第一部分的高度. var topHeight = $('.top').height(); //获取第二部分的高度. var navHeight = $('.nav').height(); //给页面设置一个滚动事件. $(window).on('scroll', function () {