手机版

jQuery让控件左右移动的三种实现方法

时间:2021-11-16 来源:互联网 编辑:宝哥软件园 浏览:

方法一【注】需把控件的半铸钢钢性铸铁(铸造半钢)的位置属性设置为亲戚或绝对的。复制代码代码如下:脚本类型=' text/JAVAScript ' src=' http : js/jquery-1。8 .0 .js /脚本脚本语言='javascript' $(文档)。ready(function(){ $('#right1 ')).单击(function(){ $(。第1栏').动画({left: '=50px'},' slow ');});$('#left1 ').单击(function(){ $(。第1栏').动画({left: '-=50px'},' slow ');});});/script方法二复制代码代码如下:脚本类型=' text/JAVAScript ' src=' http : js/jquery-1。8 .0 .js /脚本脚本语言='javascript' $(文档)。ready(function(){ $(“# right 2”)).单击(function(){ $(。第2栏').css(“”左边距,'=50px ');});$('#left2 ').单击(function(){ $(。第2栏').css(“”左边距,'-=50px ');});});/script方法三复制代码代码如下:脚本类型=' text/JAVAScript ' src=' http : js/jquery-1。8 .0 .js /脚本脚本语言='javascript' $(文档)。ready(function(){ $('#right3 ')).单击(function(){ $(。第3栏').动画({width:'=50px'},222);});$('#left3 ').单击(function(){ $(。第3栏').动画({width:'-=50px'},222);});});/script全部代码复制代码代码如下:DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN ' ' http://www .w3。L1-过渡时期。DTD ' html xmlns=' http://www .w3。org/1999/XHTML ' head meta http-equiv=' Content-Type ' Content=' text/html;charset=utf-8'/title无标题文档/title脚本类型=' text/JAVAScript ' src=' http : js/jquery-1。8 .0 .js /脚本脚本语言='javascript' $(文档)。ready(function(){ $('#right1 ')).单击(function(){ $(。第1栏').动画({left: '=50px'},' slow ');});$('#left1 ').单击(function(){ $(。第1栏').动画({left: '-=50px'},' slow ');});$('#right2 ').单击(function(){ $(。第2栏').css(“”左边距,'=50px ');});$('#left2 ').单击(function(){ $(。第2栏').css(“”左边距,'-=50px ');});$('#right3 ').单击(function(){ $(。第3栏').动画({width:'=50px'},222);});$('#left3 ').单击(function(){ $(。第3栏').动画({width:'-=50px'},222);});});/script/head body style=' text-align : center;'button id=' left 1 '/button id=' right 1 '/button div class=' block 1 ' id=' block ' style=' position : relative;'img src=' http : img/csdn _ RES . jpg '/div button id=' left 2 '/button id=' right 2 '/button div class=' block 2 ' id=' block ' img src=' http : img/csdn _ RES . jpg '/div button id=' left 3 '/button div class=' block 3 ' id=' block ' img src=' http 3360 img/CSG '效果图

版权声明:jQuery让控件左右移动的三种实现方法是由宝哥软件园云端程序自动收集整理而来。如果本文侵犯了你的权益,请联系本站底部QQ或者邮箱删除。