jquery写一个图片局部放大镜效果代码
代码语言:html
所属分类:图片放大
代码描述:jquery写一个图片局部放大镜效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>BFW NEW PAGE</title> <script id="bfwone" data="dep=jquery.17&err=0" type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/bfwone.js"></script> <script type="text/javascript"> var glass = function(id, dia, mr, shape) { dia = dia == undefined?100: dia; mr = mr == undefined?2: mr, shape = shape == undefined?50: shape var _this = this; var dx1 = $("#"+id); var dx1width = parseInt(dx1.css("width").replace("px", "")); var dx2 = dx1.clone(); var gls = "<div id='"+id+"gls'></div>" var glsimg = "<img id='"+id+"glsimg' src='"+dx1.attr("src")+"'>" dx2.attr("id", id+"clone") dx1.after(dx2); dx2.after(gls); var gls1 = $("#"+id+"gls"); gls1.append(glsimg); var glsimg1 = $("#"+id+"glsimg"); dx1.parent().css({ "position": "relative" }) dx1.css({ "position": "absolute", "z-index": "1" }) dx2.css({ "width": dx1width, "position": "absolute", "z-index": "3", "opacity": "0", "cursor": "crosshair", "margin": dx1.css("margin"), "left": dx1.css("left"), "top": dx1.css("top"), "right": dx1.css("right"), "bottom": dx1.css("bottom&quo.........完整代码请登录后点击上方下载按钮下载查看
网友评论0