您现在的位置:文学网 > 西方文学

jquery实现input表达输入文字,文字放大镜特效 - form表单按钮

发布时间:2019-05-26 22:24编辑:本站原创阅读(53)

    jquery实现input表达输入文字,文字放大镜特效发布时间:2015-09-0621:42:57您是第位浏览者本js特效代码兼容:ie6、ie7、ie8、ie9、ie10、ie11、chrome、firefox、opera、safari、等浏览器$.=function(type){/**type1:身份证2:电话号码*号码放大镜随着字数延伸*身份证分割:33444手机号码分割:344*/varglassT=$(this).offset().top,glassL=$(this).offset().left;//定义预展示输入框的坐标vargId=$(this).attr(id);varglassStr=divid=bigGlassnobrspan/spanspan/spanspan/spanspan/span/nobr/div$(this).after($(glassStr));$(this).keyup(function(){showBigGlass();})//生成放大镜functionshowBigGlass(){varinputVal=$(#+gId).val(),l=;$(#bigGlass).css({top:(glassT-50)+px,left:glassL+px});style=top:+(glassT-50)+px;left:+glassL+px;if(!inputVal){$(#bigGlass).hide();returnfalse;}//身份证号码与电话号码展示逻辑不同,做区分$(#bigGlass).html(nobrspan/spanspan/spanspan/spanspan/span/nobrif(type==1){if(l=3){$(#bigGlass).find(span).eq(0).text(inputVal);}elseif(l=6){$(#bigGlass).find(span).eq(0).text((0,3));$(#bigGlass).find(span).eq(1).text((3,l));}elseif(l=14){$(#bigGlass).find(span).eq(0).text((0,3));$(#bigGlass).find(span).eq(1).text((3,6));$(#bigGlass).find(span).eq(2).text((6,l));}else{$(#bigGlass).find(span).eq(0).text((0,3));$(#bigGlass).find(span).eq(1).text((3,6));$(#bigGlass).find(span).eq(2).text((6,14));$(#bigGlass).find(span).eq(3).text((14,l));}}else{if(l=3){$(#bigGlass).find(span).eq(0).text(inputVal);}elseif(l=7){$(#bigGlass).find(span).eq(0).text((0,3));$(#bigGlass).find(span).eq(1).text((3,l));}else{$(#bigGlass).find(span).eq(0).text((0,3));$(#bigGlass).find(span).eq(1).text((3,7));$(#bigGlass).find(span).eq(2).text((7,l));}}$(#bigGlass).show();}//控制数字放大镜的显示与销毁$(document).click(function(event){varobj=||;if($(obj).attr(id)!=gId){$(#bigGlass).html().hide();}else{showBigGlass();}});}$(function(){$(#cardCode).bigGlass(1);$(#cardCode1).bigGlass(2);})。

    jquery实现input表达输入文字,文字放大镜特效 - form表单按钮

    上一篇:刘嘉玲称新片没戏服 梁家辉:还要不停“露点”

    下一篇:经典企业精神宣传口号