admin管理员组文章数量:1414908
Given this code that creates and opens a ctools modal in a Drupal 6 site:
var content = 'my content';
var title = 'my title';
Drupal.CTools.Modal.show();
$('#modal-title').html(title);
$('#modal-content').html(content);
Drupal.attachBehaviors();
How do I add a link in content that will close the modal?
Didn't work:
- Adding a link with class "close". This is how the right corner close link that ctools automatically adds to the modal works
- Using
onclick="Drupal.CTools.Modal.show();"
- Using
onclick="Drupal.CTools.Modal.close();"
Any ideas what I might be doing wrong?
Given this code that creates and opens a ctools modal in a Drupal 6 site:
var content = 'my content';
var title = 'my title';
Drupal.CTools.Modal.show();
$('#modal-title').html(title);
$('#modal-content').html(content);
Drupal.attachBehaviors();
How do I add a link in content that will close the modal?
Didn't work:
- Adding a link with class "close". This is how the right corner close link that ctools automatically adds to the modal works
- Using
onclick="Drupal.CTools.Modal.show();"
- Using
onclick="Drupal.CTools.Modal.close();"
Any ideas what I might be doing wrong?
Share Improve this question edited Mar 20, 2015 at 0:03 Kara 6,22616 gold badges53 silver badges58 bronze badges asked Jul 8, 2011 at 16:18 JustinJustin 2,9346 gold badges41 silver badges66 bronze badges2 Answers
Reset to default 6Try onclick="Drupal.CTools.Modal.dismiss()"
instead of .close().
Based on Alexander answer, here you have another approach when you click out, the modal is dismiss.
$('#modalBackdrop').live("click", function(){ Drupal.CTools.Modal.dismiss(); });
本文标签: javascriptHow do you close a manually created and opened ctools modal in Drupal 6Stack Overflow
版权声明:本文标题:javascript - How do you close a manually created and opened ctools modal in Drupal 6? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745185050a2646643.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论