settimeout

javascript图片轮换2

[亡魂溺海] 提交于 2020-01-08 04:29:56
图片轮换是一种相当复杂的技术,早些年基本用flash实现。这里有一个 链接 ,教大家如何用flash实现它的。之所以用flash,是因为flash是基于帧的,这与图片轮换的原理相当接近。为了模拟帧的效果,我们要用到overflow把多余的部分遮罩掉,也就是flash中常说的遮罩层。在Flash中,连时间轴都是可视的,而我们则全凭想象力与数学来计算现在是到了哪一张图。加之,flash有Robert Penner大神的缓动公式,那实在太耀眼,直到script.aculo.us类库搞出自己的缓动公式,才扭转局面。 我们来看一看图片轮换的结构层。它应该包含框体,图片展示区,图片滑动层与分页栏。原谅我制造这么多词汇,因为没有个名词讲解就难以为继了,前人也没有做这样的总结,个个都不愿意分享一下。框体就是一个div元素,作用有两个:提供相册的边框与作为分页栏的包含块。如果不清楚什么叫包含块(containing block)的话,自己查阅CSS权威指南吧。接着下来图片展示区与图片滑动层,也就是我实现 新式无缝滚动 的那一种结构,一个很干净的无序列表,所有难点都转移到设置它的CSS上。至于图片展示区就是ul元素,大小为一张图片的大小;图片滑动层就是那个li元素,也只有一个li元素而已,利用CSS强制把它里面的图片不换行向左浮动,并设置li元素一个很大很大的宽度,好让它一行容纳所有图片

前端之JavaScript基础(二)

浪子不回头ぞ 提交于 2020-01-07 16:22:04
文章目录 一. 序言 二. BOM对象 2.1 location对象 2.2 弹出框对象 2.3 计时类的对象 三. DOM对象 3.1 操作HTML和CSS 查找标签 标签的操作 3.2 事件处理 常用事件 绑定事件的方式 一. 序言 前面学的为JavaScript的基本语法并不能实现网页的交互,JavaScript的交互体现在一下两种模式: BOM(Browser Object Model)是指浏览器对象模型,它使 JavaScript 能够操作浏览器。 DOM (Document Object Model)是指文档对象模型,JavaScript通过它,可以访问HTML和CSS内容并进行修改,还能进行事件处理。 Window对象是JavaScript最高层对象之一,由于window对象是其它大部分对象的共同祖先,在调用window对象的方法和属性时,可以省略window对象的引用。例如:window.document.write()可以简写成:document.write()。 二. BOM对象 所有浏览器都支持 window 对象。它表示浏览器窗口。 全局变量是 window 对象的属性。全局函数是 window 对象的方法。 一些常用的Window方法: window.innerHeight - 浏览器窗口的内部高度 window.innerWidth -

I want the div show when mouse hover on another, and disppear automatic after few seconds with jquery

人盡茶涼 提交于 2020-01-07 07:26:05
问题 first here is my html code: <div class="outter"> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> </div> <div class="inner"></div> when my mouse over the "item",the "inner" show,when mouseout the "inner" disppeared: $(".item").hover(function(){ // setTimeout(function(){$('.inner').hide('slow');},2000); $('.inner').show('slow'); },function(){ $('.inner').stop(true, true).hide('slow'); }) as well I want when "inner" showed,it will disppear

JavaScript之Promise对象

China☆狼群 提交于 2020-01-07 06:07:08
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> Promise 是异步编程的一种解决方案,比传统的解决方案——回调函数和事件——更合理和更强大。它由社区最早提出和实现,ES6 将其写进了语言标准,统一了用法,原生提供了 Promise 对象。 Promise 对象是一个代理对象(代理一个值),被代理的值在 Promise 对象创建时可能是未知的。它允许你为异步操作的成功和失败分别绑定相应的处理方法(handlers)。 这让异步方法可以像同步方法那样返回值,但并不是立即返回最终执行结果,而是一个能代表未来出现的结果的 Promise 对象。 Promise 对象有以下两个特点: 对象的状态不受外界影响。Promise 对象代表一个异步操作,有三种状态:pending(进行中)、fulfilled(已成功) 和 rejected(已失败)。只有异步操作的结果,可以决定当前是哪一种状态,任何其他操作都无法改变这个状态。这也是Promise这个名字的由来,它的英语意思就是“承诺”,表示其他手段无法改变。 Promise 对象的状态改变,只有两种可能:从 pending 变为 fulfilled 和 从 pending 变为 rejected。只要这两种情况发生,状态就凝固了,不会再变了,会一直保持这个结果,这时就称为 resolved(已定型)。如果改变已经发生了

Set timeout function with AsyncTask [Android]

青春壹個敷衍的年華 提交于 2020-01-07 02:01:13
问题 In my case, I would like to get the button pressed and get process with the timeout. When button clicked then it will verify the accNo with web services, if the verification (ProgressDialog) is over 5 seconds then it will stop and display the alertDialog to notice user "Timeout". But now I have not idea when I in testing with 1 milliseconds, in logically it will pause in alertDialog until get pressed, but now it will display the dialog in milliseconds then auto dismiss and intent to next

【踩坑】前端promise 配合 setTimeout/setIntval

丶灬走出姿态 提交于 2020-01-07 00:45:59
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 打算模拟一下网络请求 随即使用setTimeout来模拟一下 发现 方法1 可以正常返回 方法2 会返回一个setTimeout句柄(本次setTimeout的身份id 可以配合clearTimeout清除定时 调用setTimeout会立即返回计时器自身句柄 且返回值不会被callBack的返回值覆盖 写成闭包的形式是为了能够让函数声明后立即执行一次 否则返回的不是一个有效值 而是一个function 来源: oschina 链接: https://my.oschina.net/u/4125329/blog/3153995

ES6 promise

岁酱吖の 提交于 2020-01-06 22:10:50
回调与promise 方法 用于请求数据(模拟) resolve代表成功时要做的事情 function f() { return new Promise(resolve => { setTimeout(function() { resolve(); }, 1000); }) } f() .then(function() { console.log(1); //return promise实例,才能继续.then() return f(); }) .then(function() { console.log(2); return f(); }) .then(function() { console.log(4); return f(); }) .then(function() { console.log(3); return f(); }) .then(function() { console.log(5); return f(); }) .then(function() { console.log(6); }); 案例: Promise 新建后立即执行,所以首先输出的是Promise,然后,then方法指定的回调函数,将在当前脚本所有同步任务执行完才会执行,所以resolved最后输出 let promise=new Promise(resolve=>{ console.log(

Timeout in an Activity Function of Azure Durable Functions

ぃ、小莉子 提交于 2020-01-06 18:36:29
问题 In my activity function I am doing this do { await timeout(500); } while (await getStatus() === false); where, function timeout(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } getStatus() is a function that does a get request to see if process in other service is complete or not and returns true or false based on this. I need my activity function to wait before the process in other service is complete. But activity function execution by default is limited to 5 minutes. my

clearTimeout doesn't work due to ajax jquery function, bootstrap modal event not handled

江枫思渺然 提交于 2020-01-06 18:26:11
问题 I’ve a ridiculous problem with my javascript setTimeout and jquery ajax function. I’ve a webpage who needed to be refreshed every x seconds. I use a setTimeout who call my ajax function every x seconds. The user has the opportunity to use a boostrap modal to enter information. What I want is to clear the timeout when the modal is shown and restart the timeout when the user closed. My problem is on the event “shown.bs.modal” none of the functions are executed, even the alerts so my setTimout

QQ空间说说如何批量删除

家住魔仙堡 提交于 2020-01-06 18:23:11
事件背景: 今天突发奇想,想把自己之前发的说说都删除了,结果就有了下面的代码 1、按F12 2、点击 Console,进入Console项 3、使用以下代码: var delay = 1000; function del() { document.querySelector('.app_canvas_frame').contentDocument.querySelector('.del_btn').click(); setTimeout("yes()", delay); } function yes() { document.querySelector('.qz_dialog_layer_btn').click(); setTimeout("del()", delay); } del(); 4、回车即可 来源: 51CTO 作者: wangqiang_cyou 链接: https://blog.51cto.com/9360230/2070958