一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

js实现上下左右弹框划出效果

时间:2017-06-07 编辑:简简单单 来源:一聚教程网

效果图:

图(1)初始图

图(2)点击“从右侧划出”

代码如下:

 

 代码如下复制代码

 

 

 

 上下左右弹框划出效果

 

 

 

 

 

 从右侧划出

 从左侧划出

 从上面划下

 从下面划上

 

 

 

 

 

 右侧划出

 

 

 左侧划出

 

 

 从上面划下

 

 

 从上面划下

 

 

 

 

 $(function(){

 var rightBtn = $('#rightBtn'),leftBtn = $('#leftBtn'),topBtn = $('#topBtn'),botBtn = $('#botBtn');

 var oAside = $('#aside');

 rightBtn.on("click",function(){

 $('.leftContent').hide();

 $('.topContent').hide();

 $('.botContent').hide();

 $('.rightContent').show();

 oAside.addClass('active');

 });

 leftBtn.on("click",function(){

 $('.rightContent').hide();

 $('.topContent').hide();

 $('.botContent').hide();

 $('.leftContent').show();

 oAside.addClass('active');

 });

 topBtn.on("click",function(){

 $('.rightContent').hide();

 $('.leftContent').hide();

 $('.botContent').hide();

 $('.topContent').show();

 oAside.addClass('active');

 });

 botBtn.on("click",function(){

 $('.rightContent').hide();

 $('.leftContent').hide();

 $('.topContent').hide();

 $('.botContent').show();

 oAside.addClass('active');

 });

 $('.hideAside').on("click",function(){

 oAside.removeClass('active');

 });

 })

 

 


 

热门栏目