弹出式签名不起作用
Popup signin not working
我做了一个弹出式签名,当点击签名按钮时,会弹出名称和密码字段,还有一个关闭符号,点击它会关闭弹出窗口,但即使提供了文档准备功能,它也不起作用
<html>
<head>
<title>Untitled Document</title>
<script>
$( document ).ready(function() {
$('.toggleModal').on('click', function (e) {
$('.modal').toggleClass('active');
});
});
</script>
<style>
@import "compass/css3/shared";
@font-face {
font-family: 'ios7-icon';
src:
url('http://ios7-icon-font-demo.herokuapp.com/fonts/ios7-icon.woff') format('woff'),
url('http://ios7-icon-font-demo.herokuapp.com/fonts/ios7-icon.ttf') format('ttf');
font-weight: normal;
font-style: normal;
}
$blue : #007aff;
$green : #4dd865;
$red : #ff3b30;
$white : #ffffff;
$black : #000000;
*, *:before, *:after {
-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}
body {
padding: 50px;
font-family: 'Helvetica Neue' !important;
font-weight: 300;
}
.wrapper {
max-width: 500px;
margin: 0 auto;
}
h1 {
font-weight: 100;
font-size: 45px;
color: $blue;
}
h2 {
font-weight: 500;
font-size: 21px;
margin-bottom: 15px;
}
section {
margin-top: 30px;
p {
line-height: 1.4;
margin-bottom: 20px;
}
}
button {
@include experimental('appearance',
none,
webkit, moz, o, ms, not khtml);
@include border-radius(5px);
border: none;
outline:none;
font: inherit;
cursor: pointer;
margin: 0;
padding: 0;
background: $white;
color: $blue;
font-weight: 300;
font-size: 16px;
@include border-radius(0px);
&:hover {
text-decoration: underline;
}
/* &:last-child {
border-color: red;
margin-bottom: 0;
}*/
&.button-border {
@include border-radius(5px);
padding: 10px 12px 8px 12px;
border: 1px solid $blue;
&:hover {
background: $blue;
color: $white;
text-decoration: none;
}
}
&.button-success {
color: $green;
border-color: $green;
&:hover {
background: $green;
}
}
&.button-error {
color: $red;
border-color: $red;
&:hover {
background: $red;
}
}
}
.modal {
display: none;
position: fixed;
top: 50%;
left: 50%;
width: 400px;
height: auto;
margin-left: -200px;
margin-top: -150px;
background-color: $white;
padding: 25px;
border-radius: 5px;
z-index: 10;
box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
&.active {
display: block;
}
header {
position: relative;
}
h2 {
text-align: center;
}
.close {
position: absolute;
top: 3px;
right: 0;
margin: 0;
}
}
.pull-right {
float: right;
}
.icon {
display: inline-block;
font-size: inherit;
font-family: 'ios7-icon';
margin-right: 5px;
color: inherit;
-webkit-text-rendering: geometricPrecision;
-moz-text-rendering: geometricPrecision;
-ms-text-rendering: geometricPrecision;
-o-text-rendering: geometricPrecision;
text-rendering: geometricPrecision;
}
</style>
</head>
<body>
<div class="wrapper"> <section>
<button class="button-border toggleModal">
sign in
</button>
</section>
<div class="modal">
<header>
<h2>Sign in</h2>
<button class="close toggleModal">Close</button>
</header>
<section>
<input style="margin-bottom: 15px;" type="text" placeholder="Username" id="username" name="username">
<input style="margin-bottom: 15px;" type="password" placeholder="Password" id="password" name="password">
<input class="login-sub" type="submit" id="sign-in" value="Sign In">
</section>
</div>
</body>
</html>
检查模态是否被隐藏,代码中是否缺少活动类,您可以切换可见性:
$( document ).ready(function() {
$('.toggleModal').on('click', function (e) {
$('.modal').toggle();
});
});
工作小提琴这里
<html>
<head>
<title>Untitled Document</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script>
jQuery(document).ready(function(){
$( document ).ready(function() {
$('.toggleModal').click(function () {
$('.modal').toggle();
});
});
});
</script>
<style>
@import "compass/css3/shared";
@font-face {
font-family: 'ios7-icon';
src:
url('http://ios7-icon-font-demo.herokuapp.com/fonts/ios7-icon.woff') format('woff'),
url('http://ios7-icon-font-demo.herokuapp.com/fonts/ios7-icon.ttf') format('ttf');
font-weight: normal;
font-style: normal;
}
$blue : #007aff;
$green : #4dd865;
$red : #ff3b30;
$white : #ffffff;
$black : #000000;
*, *:before, *:after {
-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}
body {
padding: 50px;
font-family: 'Helvetica Neue' !important;
font-weight: 300;
}
.wrapper {
max-width: 500px;
margin: 0 auto;
}
h1 {
font-weight: 100;
font-size: 45px;
color: $blue;
}
h2 {
font-weight: 500;
font-size: 21px;
margin-bottom: 15px;
}
section {
margin-top: 30px;
p {
line-height: 1.4;
margin-bottom: 20px;
}
}
button {
@include experimental('appearance',
none,
webkit, moz, o, ms, not khtml);
@include border-radius(5px);
border: none;
outline:none;
font: inherit;
cursor: pointer;
margin: 0;
padding: 0;
background: $white;
color: $blue;
font-weight: 300;
font-size: 16px;
@include border-radius(0px);
&:hover {
text-decoration: underline;
}
/* &:last-child {
border-color: red;
margin-bottom: 0;
}*/
&.button-border {
@include border-radius(5px);
padding: 10px 12px 8px 12px;
border: 1px solid $blue;
&:hover {
background: $blue;
color: $white;
text-decoration: none;
}
}
&.button-success {
color: $green;
border-color: $green;
&:hover {
background: $green;
}
}
&.button-error {
color: $red;
border-color: $red;
&:hover {
background: $red;
}
}
}
.modal {
display: none;
position: fixed;
top: 50%;
left: 50%;
width: 400px;
height: auto;
margin-left: -200px;
margin-top: -150px;
background-color: $white;
padding: 25px;
border-radius: 5px;
z-index: 10;
box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
&.active {
display: block;
}
header {
position: relative;
}
h2 {
text-align: center;
}
.close {
position: absolute;
top: 3px;
right: 0;
margin: 0;
}
}
.pull-right {
float: right;
}
.icon {
display: inline-block;
font-size: inherit;
font-family: 'ios7-icon';
margin-right: 5px;
color: inherit;
-webkit-text-rendering: geometricPrecision;
-moz-text-rendering: geometricPrecision;
-ms-text-rendering: geometricPrecision;
-o-text-rendering: geometricPrecision;
text-rendering: geometricPrecision;
}
</style>
</head>
<body>
<div class="wrapper"> <section>
<button class="button-border toggleModal">
sign in
</button>
</section>
<div class="modal">
<header>
<h2>Sign in</h2>
<button class="close toggleModal">Close</button>
</header>
<section>
<input style="margin-bottom: 15px;" type="text" placeholder="Username" id="username" name="username">
<input style="margin-bottom: 15px;" type="password" placeholder="Password" id="password" name="password">
<input class="login-sub" type="submit" id="sign-in" value="Sign In">
</section>
</div>
</body>
</html>
我添加
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
和更新:
<script>
jQuery(document).ready(function(){
$( document ).ready(function() {
$('.toggleModal').click(function () {
$('.modal').toggle();
});
});
});
</script>
相关文章:
- FB.login有效,但弹出窗口不起作用;t关闭
- jquery 1.3.2中的多选在弹出窗口中不起作用
- 模式弹出窗口内的按钮点击不起作用
- 引导程序弹出窗口(bootbox)中的Javascript事件不起作用
- 弹出加载不起作用
- 我试图使用引导模式类来制作一个弹出注册表单,但弹出没有'不起作用
- ajax加载图像第二次在弹出jquery上不起作用
- Twitter引导程序弹出在网站上不起作用:未获取引用错误
- 按钮点击事件在弹出窗口中不起作用
- 在chrome扩展的弹出窗口中,警报不起作用
- Phonegap构建:通知/弹出在android中不起作用
- PHP变量作为Javascript弹出窗口不起作用
- 如果在外部单击,则隐藏弹出窗口.为什么我的脚本没有'不起作用
- chrome扩展弹出相同的选项卡仍然不起作用
- Javascript按钮单击在Chrome扩展弹出窗口中不起作用
- 弹出式签名不起作用
- 添加弹出式JS滑块到菜单列表-链接不起作用
- 弹出式表单不起作用
- .replace()不起作用.给出错误.replace不是一个函数
- Angularjs的日期选择器弹出式bootstrap-ui在视图中不起作用