Javascript marquee hover magnification effect implementation code_text special effects
WBOY
Release: 2016-05-16 17:46:35
Original
1180 people have browsed it
Friends who have used QQ space should be familiar with this. The effects are quite dazzling, but they are implemented in flash, so can javascript be used? I thought about it for three days and finally got it almost done, but there are still some imperfections. , I hope everyone can understand me, I will improve it in the future.
Let me talk about the idea first: First dynamically create an html structure
This is very important, and then set a Use a timer to simulate the movement of the img, and bind the onmouseenter and onmouseleave events of the outer div. Finally, return the outer div object.
sx.activex.dynamicpic={ init:function(imga,border, margin,w,h,step,speed){ var demo=document.createElement("div"); var tbody=document.createElement("tbody"); var demo1=document.createElement ("td"); var demo2=document.createElement("td"); var table=document.createElement("
The imga of the function parameter is the array you want to pass in the img address, border is the border attribute of the image, and margin is the space between the images distance, w is the width of the outer div, h is the same, step is the number of steps the timer takes to move the image once, and speed is the time interval of the timer. The above timer code borrowed a piece of code from the Internet, But I made some improvements myself. The calling code is given below: