onmouseover Event thumbnail Image slide correction version

Source: Internet
Author: User

#slideshow {width:100px;height:100px;position:relative; overflow:hidden;}
<! Doctype html>
Function addloadevent (func) {    //does not matter how many functions are executed after the page is loaded var oldonload =  window.onload;if (typeof window.onload !=  ' function ') {Window.onload = func;} Else{window.onload = function () {oldonload (); func ();}}} Function moveelement (Elementid,final_x,final_y,interval) {if (!document.getelementbyid)  return  False;if (!document.getelementbyid (elementid))  return false;var elem =  document.getElementById (ElementID); if (elem.movement) {              cleartimeout (elem.movement);       //resets to prevent lag in animation effects}var  xpos = parseint (Elem.style.left);  //parseint (string) extracts the numeric information inside the string, since many arithmetic comparisons are performed later. Var ypos = parseint (Elem.style.top);   //parsefloat (string) extracts a numeric value (that is, a floating-point number) with decimals. if (xpos == final_x && ypos == final_y) {return true;}if (xpos < final_x) { xpos++;}        //if xpos is smaller than the left end of the endpoint, add 1.if (xpos > final_x) { xpos--;}        //if Xpos is greater than the end of the left, give it minus 1.if (ypos < final_y) { ypos++;}        //if Ypos is smaller than the left end of the endpoint, add 1.if (ypos > final_y) { ypos--;}        //if Ypos is greater than the end of the left, give it 1.elem.style.left = xpos +  "px";elem.style.top = ypos +  "px";//var  repeat = function ()  { Moveelement (elementid, final_x,final_y,interval)} varrepeat =  "MoveElement ('"  +  elementid +  "',"  + final_x +  ","  + final_y +  ","  +  interval +  ")";  elem.movement = settimeout (repeat,interval);  // Create an attribute movement,element.property = value for an element;} Function prepareslideshow () {//ensure that theDom method is supported by the browser. if (!document.getelementsbytagname)  return false;if (!document.getelementbyid)  return false ;//Ensure that the element exists. if (!document.getelementbyid ("linklist"))  return false;if (!document.getelementbyid ("Preview"))   return false;//applies a style to a picture. Var preview = document.getelementbyid ("preview");p review.style.position =  "Absolute"; preview.style.left =  "0px";p review.style.top =  "0px";//Get all the links in the list. Var list = document.getelementbyid ("linklist");var links =  List.getelementsbytagname ("a");//Add an animated effect to the MouseOver event. Links[0].onmouseover = function () {moveelement ("preview", -100,0,10);} Links[1].onmouseover = function () {moveelement ("preview", -200,0,10);} Links[2].onmouseover = function () {moveelement ("preview", -300,0,10);}} Addloadevent (prepareslideshow);

This case material:

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/82/0A/wKiom1dIRUjDofk4AAAO8DE9jPI584.gif-wh_500x0-wm_3 -wmp_4-s_2982606196.gif "title=" Topics.gif "alt=" Wkiom1dirujdofk4aaao8de9jpi584.gif-wh_50 "/>

Browser effects:

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/82/09/wKioL1dIRmaTRgJuAAAkeB6sH9k822.jpg-wh_500x0-wm_3 -wmp_4-s_3509555959.jpg "title=" 36020160527210224875.jpg "alt=" Wkiol1dirmatrgjuaaakeb6sh9k822.jpg-wh_50 "/>

onmouseover Event thumbnail Image slide correction version

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.