我想在对话框(灯箱样式)中显示一个注册/登录表单,但是在单击触发器超链接时,两者都只显示一次。单击一次后,页面仍将模糊,但对话框将不显示任何内容。
省略empty()函数时,此代码可以很好地工作,但是登录和注册表单都显示在1个对话框中。当用户单击登录链接时,我只想显示登录表单,而当用户单击注册超链接时,我只想显示登录表单。
请参见下面的代码(HTML,CSS,jQuery)。
<html>
<head>
<style>
#lightbox {
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
background:rgba(0,0,0,0.5);
display:none;
}
#invisible_register, #invisible_login {
display:none;
position:absolute;
}
</style>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>
jQuery(document).ready(function($) {
$('.trigger_register').click(function(e) {
e.preventDefault();
$('#lightbox').empty().append($('#invisible_register'));
$('#lightbox').show();
$('#invisible_register').show();
});
$('.trigger_login').click(function(e) {
e.preventDefault();
$('#lightbox').empty().append($('#invisible_login'));
$('#lightbox').show();
$('#invisible_login').show();
});
//Click anywhere on the page to get rid of lightbox window
$("#lightbox").click(function() {
$('#lightbox').hide();
});
//Except for the dialog box
$(".dialog").click(function(e) {
e.stopPropagation();
return false;
});
});
</script>
</head>
<body>
<div id="lightbox"></div>
<div id="invisible_register">
<div class="container">
<div class="dialog"> …Run Code Online (Sandbox Code Playgroud) 我有两张桌子; 列表和出价.我想使用Ecto列出所有最高出价高于1且低于10的商品.有关架构和查询的更多信息,请参阅下面的代码.
数据库架构
listings
id
name
bids
listing_id
amount
Run Code Online (Sandbox Code Playgroud)
program.ex
Repo.all(
from l in Listing,
where: (SELECT MAX(amount) FROM bids WHERE listing_id = l.id) > 1 and
(SELECT MAX(amount) FROM bids WHERE listing_id = l.id) < 10)
Run Code Online (Sandbox Code Playgroud)
怎么会这样呢?