Home >Web Front-end >JS Tutorial >jquery original pop-up layer folding effect Click fold to pop up a layer_jquery

jquery original pop-up layer folding effect Click fold to pop up a layer_jquery

WBOY
WBOYOriginal
2016-05-16 16:55:411147browse

The pop-up layer effect is used on many websites. Today I will sort out a small effect used in recent projects. Click fold to pop up a layer for users to fill in information. The pop-up layer code is dynamically created by jq. Everyone's writing method is different and their needs are also different. Just make all the choices that suit you.

html:

Copy code The code is as follows:

Copy code The code is as follows:

*{ margin:0; padding:0;}
body{ font:14px 'Microsoft YaHei'; color :#555;}
li{ list-style:none;}
.layer_bg{ position:fixed; top:0; left:0; width:100%; height:100%; background:#000; z-index:10; display:none;}
.layer_item{ position:fixed; left:50%; top:50%; width:600px; margin-left:-300px; display:inline; overflow:hidden; background:#fff; z-index:11;}
.layer_item .layer_title{ float:left; width:100%; height:75px; line-height:75px; overflow:hidden; background:#FF4E00;}
.layer_item .layer_title h1{ float:left; font-weight:normal; font-size:35px; text-indent:20px; color:#fff;}
.layer_item .layer_title a{ float:right; width :75px; height:75px; line-height:65px; text-align:center; font-size:60px; color:#fff; text-decoration:none; background:#535961;}
.layer_item ul{ float :left; width:100%; padding:10px 0;}
.layer_item ul li{ float:left; width:100%; line-height:35px; padding:10px 0; overflow:hidden;}
.layer_item ul li span{ float:left; width:100px; text-indent:20px; text-align:right; padding-right:10px;}
.layer_item ul li span b{ color:Red;}
.layer_item ul li .layer_txt{ float:left; width:300px; height:23px; line-height:23px; padding:5px; border:1px solid #dfdfdf;}
.layer_item ul li #message{ width: 400px; height:150px;}
.layer_item .layer_btn{ float:left; width:100%; padding-bottom:40px;}
.layer_item .layer_btn .layer_submit_btn{ float:left; width:100px; height :40px; text-align:center; overflow:hidden; background:#FF4E00; color:#fff; margin-left:110px; display:inline; border:none; font:14px 'Microsoft YaHei'; line-height:40px ; }

jq:
Copy code The code is as follows:

$(function () {
var layer_bg = '
'; //layer_bg
var layer = '
'; //layer_item
layer = '

我要报名

x
'; //layer_title
layer = '
    '; //layer_cont
    layer = '
  • 真实姓名*
  • ';
    layer = '
  • 手机*
  • ';
    layer = '
  • QQ:
  • ';
    layer = '
  • 报名人数*
  • ';
    layer = '
  • 留言:
  • ';
    layer = '
'; //layer_cont end
layer = '
';
layer = '
'; //layer_item end
$('body').append(layer_bg);
$('body').append(layer);
var winW = $(window).width();
var winH = $(window).height();
var objH = $('.layer_item').height();
var objW = $('.layer_item').width();
$('.layer_item').css({ 'height': 0 });
$('.bm').click(function () {
$('.layer_bg').css('opacity',0.7).fadeIn();
$('.layer_item').animate({ 'height': objH, 'marginTop': -objH / 2 },500);
});
$('.layer_title a').on('click', function () {
$('.layer_item').animate({ 'height': 0, 'marginTop': 0 }, 200, function () {
$('.layer_bg').fadeOut();
});
});
});

效果图:
jquery original pop-up layer folding effect Click fold to pop up a layer_jquery 
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn