Web Front-end
JS Tutorial
JS Album Effect Automatic Play [Local Integration]_Image Special Effects
JS Album Effect Automatic Play [Local Integration]_Image Special Effects
]
[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute ] <script> function tM(Message) { $("testMessage").innerHTML=Message } function dR(topr) { document.write(topr) } function $(eleId) {return document.getElementById(eleId)} //预载图片 var imasrc=new Array("http://img.jb51.net/online/slide/10254068.jpg" ,"http://img.jb51.net/online/slide/10254629.jpg" ,"http://img.jb51.net/online/slide/10255187.jpg" ,"http://img.jb51.net/online/slide/10255626.jpg" ,"http://img.jb51.net/online/slide/10260076.jpg" ,"http://img.jb51.net/online/slide/10260471.jpg" ,"http://img.jb51.net/online/slide/10261022.jpg" ,"http://img.jb51.net/online/slide/10261479.jpg")//图片路径写入数组 var preIma=new Array() var dB=new Date() for (i=0;i < imasrc.length;i++)//预载所有图片 { preLoadImg(i) } function preLoadImg(imgIndex)//预载指定图片图片 { preIma[imgIndex]=new Image() preIma[imgIndex].imgReadyStatus=false preIma[imgIndex].imgIndex=imgIndex preIma[imgIndex].onload=imgLoad preIma[imgIndex].onerror=imgError preIma[imgIndex].onabort=imgAbort preIma[imgIndex].src=imasrc[imgIndex] } function imgLoad()//预载完成 { this.imgReadyStatus=true } function imgError()//预载失败 { preLoadImg(this.imgIndex) } function imgAbort()//预载取消 { preIma.splice(this.imgIndex,1) } var checkAgain function checkImgReadyStatus()//检索加载状态 { var imgReadyStatus=true var persent=0 var dE=new Date() for (i=0;i < preIma.length;i++) { if (!preIma[i].imgReadyStatus) {imgReadyStatus=false} else {persent++} } tM("完成:"+(persent/preIma.length*100).toFixed(2)+"%<br>载入:"+persent+"张图片<br>消耗时间:"+((dE-dB)/1000).toFixed(0)+"秒")//显示进度 if (imgReadyStatus) { $("photoContrl").style.display="block" autoPlay() clearTimeout(checkAgain) } else { checkAgain=setTimeout(checkImgReadyStatus,1000)//检索频率 } } checkImgReadyStatus() //幻灯片效果 var photoIndex=0//初始化图片索引 var opacity=10//初始化透明度 var direct="--"//初始化透明度矢量 var doPlay//定义播放 var doAutoPlay//定义自动播放 function prevPhoto(){play(-1)}//前翻 function nextPhoto(){play(1)}//后翻 function autoPlay()//自动播放 { if (doAutoPlay) { clearInterval(doAutoPlay) doAutoPlay=null $("pp").innerHTML="Play" } else { play(1) doAutoPlay=setInterval("play(1)",3000)//定义自动播放频率 $("pp").innerHTML="Pause" } } function stopPlay()//停止播放 { clearInterval(doAutoPlay) doAutoPlay=null photoIndex=0 play(0) $("pp").innerHTML="Play" } function play(act)//执行动作 { if (preIma.length!=0) { if (doPlay) {clearInterval(doPlay)} doPlay=setInterval(switchPhoto,10) photoIndex=(photoIndex+act+preIma.length)%preIma.length } } function switchPhoto()//切换照片 { eval("opacity"+direct) setOpa(opacity) if (opacity <= 1) { direct="++" $("photo").src=preIma[photoIndex].src } else if (opacity >= 10) { direct="--" clearInterval(doPlay) } } function setOpa(opacity)//改变透明度 { if ($("photo").style.filter!=null) {$("photo").style.filter="alpha(opacity="+opacity*10+")"} else {$("photo").style.opacity=opacity/10} } </script>
Hot AI Tools
Undresser.AI Undress
AI-powered app for creating realistic nude photos
AI Clothes Remover
Online AI tool for removing clothes from photos.
Undress AI Tool
Undress images for free
Clothoff.io
AI clothes remover
AI Hentai Generator
Generate AI Hentai for free.
Hot Article
Hot Tools
Notepad++7.3.1
Easy-to-use and free code editor
SublimeText3 Chinese version
Chinese version, very easy to use
Zend Studio 13.0.1
Powerful PHP integrated development environment
Dreamweaver CS6
Visual web development tools
SublimeText3 Mac version
God-level code editing software (SublimeText3)
Hot Topics
1378
52
How to use JS and Baidu Maps to implement map pan function
Nov 21, 2023 am 10:00 AM
How to use JS and Baidu Map to implement map pan function Baidu Map is a widely used map service platform, which is often used in web development to display geographical information, positioning and other functions. This article will introduce how to use JS and Baidu Map API to implement the map pan function, and provide specific code examples. 1. Preparation Before using Baidu Map API, you first need to apply for a developer account on Baidu Map Open Platform (http://lbsyun.baidu.com/) and create an application. Creation completed
Recommended: Excellent JS open source face detection and recognition project
Apr 03, 2024 am 11:55 AM
Face detection and recognition technology is already a relatively mature and widely used technology. Currently, the most widely used Internet application language is JS. Implementing face detection and recognition on the Web front-end has advantages and disadvantages compared to back-end face recognition. Advantages include reducing network interaction and real-time recognition, which greatly shortens user waiting time and improves user experience; disadvantages include: being limited by model size, the accuracy is also limited. How to use js to implement face detection on the web? In order to implement face recognition on the Web, you need to be familiar with related programming languages and technologies, such as JavaScript, HTML, CSS, WebRTC, etc. At the same time, you also need to master relevant computer vision and artificial intelligence technologies. It is worth noting that due to the design of the Web side
Essential tools for stock analysis: Learn the steps to draw candle charts with PHP and JS
Dec 17, 2023 pm 06:55 PM
Essential tools for stock analysis: Learn the steps to draw candle charts in PHP and JS. Specific code examples are required. With the rapid development of the Internet and technology, stock trading has become one of the important ways for many investors. Stock analysis is an important part of investor decision-making, and candle charts are widely used in technical analysis. Learning how to draw candle charts using PHP and JS will provide investors with more intuitive information to help them make better decisions. A candlestick chart is a technical chart that displays stock prices in the form of candlesticks. It shows the stock price
How to create a stock candlestick chart using PHP and JS
Dec 17, 2023 am 08:08 AM
How to use PHP and JS to create a stock candle chart. A stock candle chart is a common technical analysis graphic in the stock market. It helps investors understand stocks more intuitively by drawing data such as the opening price, closing price, highest price and lowest price of the stock. price fluctuations. This article will teach you how to create stock candle charts using PHP and JS, with specific code examples. 1. Preparation Before starting, we need to prepare the following environment: 1. A server running PHP 2. A browser that supports HTML5 and Canvas 3
Where to set the permission to open Douyin album? What should I do if the photos in its album are not displayed?
Mar 23, 2024 am 10:36 AM
Douyin is a popular short video application that allows users to easily capture and share the highlights of life. However, some users may encounter problems with album permissions when using Douyin. They are not clear about how to set album permissions, resulting in the inability to view or use photos in the album in Douyin. This article will explain in detail how to set the album permissions of Douyin and how to deal with the situation where Douyin cannot display the album photos. 1. Where to set the permission to open Douyin album? Setting album permissions in Douyin allows you to use the photos in the album more conveniently. The following are the steps to set album permissions: 1. Open the Douyin App and click the "Me" or "Personal Center" button. 2. On the personal center page, find the "Settings" or "Privacy Settings" button and click to enter. 3. in
How to use JS and Baidu Maps to implement map heat map function
Nov 21, 2023 am 09:33 AM
How to use JS and Baidu Maps to implement the map heat map function Introduction: With the rapid development of the Internet and mobile devices, maps have become a common application scenario. As a visual display method, heat maps can help us understand the distribution of data more intuitively. This article will introduce how to use JS and Baidu Map API to implement the map heat map function, and provide specific code examples. Preparation work: Before starting, you need to prepare the following items: a Baidu developer account, create an application, and obtain the corresponding AP
How to use JS and Baidu Map to implement map click event processing function
Nov 21, 2023 am 11:11 AM
Overview of how to use JS and Baidu Maps to implement map click event processing: In web development, it is often necessary to use map functions to display geographical location and geographical information. Click event processing on the map is a commonly used and important part of the map function. This article will introduce how to use JS and Baidu Map API to implement the click event processing function of the map, and give specific code examples. Steps: Import the API file of Baidu Map. First, import the file of Baidu Map API in the HTML file. This can be achieved through the following code:
How to set up encryption of photo album on Apple mobile phone
Mar 02, 2024 pm 05:31 PM
In Apple mobile phones, users can encrypt photo albums according to their own needs. Some users don't know how to set it up. You can add the pictures that need to be encrypted to the memo, and then lock the memo. Next, the editor will introduce the method of setting up the encryption of mobile photo albums for users. Interested users, come and take a look! Apple mobile phone tutorial How to set up iPhone photo album encryption A: After adding the pictures that need to be encrypted to the memo, go to lock the memo for detailed introduction: 1. Enter the photo album, select the picture that needs to be encrypted, and then click [Add to] below. 2. Select [Add to Notes]. 3. Enter the memo, find the memo you just created, enter it, and click the [Send] icon in the upper right corner. 4. Click [Lock Device] below


