Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/grails/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Twitter引导模式打开多个背景,Grails出现故障_Grails_Twitter Bootstrap_Modal Dialog - Fatal编程技术网

Twitter引导模式打开多个背景,Grails出现故障

Twitter引导模式打开多个背景,Grails出现故障,grails,twitter-bootstrap,modal-dialog,Grails,Twitter Bootstrap,Modal Dialog,使用Grails2.2.1,Twitter引导插件。我使用模态,我的模态设置为3种退出方式。点击x按钮,单击关闭按钮、保存按钮,或者单击模式之外的任何位置关闭 问题是,由于我使用的函数,每当我尝试打开单个模式时,都会打开两个背景。为什么会这样?对于前3种模式关闭方法,它关闭模式和两个背景。但在最后一种方法中,它只是关闭了模式和单一背景 这是我的gsp代码*秒*部分,只是我正在使用的安全插件的标记库): 但当我点击一个单一的模式链接时,仍然有两个背景打开 这似乎是Grails的问题,因为我不明白这

使用Grails2.2.1,Twitter引导插件。我使用模态,我的模态设置为3种退出方式。点击x按钮,单击关闭按钮、保存按钮,或者单击模式之外的任何位置关闭

问题是,由于我使用的函数,每当我尝试打开单个模式时,都会打开两个背景。为什么会这样?对于前3种模式关闭方法,它关闭模式和两个背景。但在最后一种方法中,它只是关闭了模式和单一背景

这是我的gsp代码*秒*部分,只是我正在使用的安全插件的标记库):

但当我点击一个单一的模式链接时,仍然有两个背景打开


这似乎是Grails的问题,因为我不明白这一点:

不确定,但我认为您应该试试(“#loginModel”).modal('show');我的意思是,不要使用load,而是尝试使用模态(“show”),在它中,您可以控制背景。不确定它是否可以帮助您:)我尝试使用.modal和“remote”作为选项。但我仍然打开了多个背景。请查看JSFIDLE链接,它是相同的代码(虽然我改为,但这并不重要,因为它呈现的是相同的),在JSFIDLE上运行良好,没有打开2个背景。我在本地尝试了它,没有sec标记(没关系),同样的代码也很好用。我想如果你使用在模态体中包含登录或注册页面,然后尝试一下。那么它应该会起作用。啊…嘿,伙计们,很抱歉。原来我在另一个页面中循环了一个页面(我通过模态的登录表单是全局性的)所以我加载了2个相同的模式)。这只是一个MVC问题,twitter模式没有问题。很抱歉浪费您的时间:(
<div id="loginModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="loginModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="loginModalLabel">Login</h3>
  </div>
  <div class="modal-body">
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
    <button class="btn btn-primary">Save changes</button>
  </div>
</div>

<div id="signupModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="signupModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="signupModalLabel">Sign Up</h3>
  </div>
  <div class="modal-body">
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
    <g:link class="btn btn-primary">Create Account</g:link>
  </div>
</div>

<sec:ifNotLoggedIn>
<g:javascript>
$('#loginModal').modal({
  remote: "${createLink(controller:'login', action:'auth')}",
  show: false
})
$('#signupModal').modal({
  remote: "${createLink(controller:'user', action:'create')}",
  show: false
})
</g:javascript>

<g:link fragment="loginModal" class="btn" data-toggle="modal">
Login
</g:link>
<br/>
<g:link fragment="signupModal" class="btn" data-toggle="modal">
Sign Up
</g:link>
</sec:ifNotLoggedIn>
$('#loginModal').modal({
  remote: "${createLink(controller:'login', action:'auth')}",
  show: false
})
$('#signupModal').modal({
  remote: "${createLink(controller:'user', action:'create')}",
  show: false
})