【发布时间】:2020-04-09 18:04:43
【问题描述】:
我的html代码是这样的:
<div class="chatbot chatbot--closed ">
<div class="chatbot__header">
<p><strong>Got a question?</strong> <span class="u-text-highlight">Ask Harry</span></p>
<svg class="chatbot__close-button icon-speech" viewBox="0 0 32 32">
<use xlink:href="#icon-speech" />
</svg>
<svg class="chatbot__close-button icon-close" viewBox="0 0 32 32">
<use xlink:href="#icon-close" data-toggle="modal" data-target="#basicModal" />
</svg>
</div>
<div class="chatbot__message-window">
<ul class="chatbot__messages">
<li class="is-ai animation">
<div class="is-ai__profile-picture">
<svg class="icon-avatar" viewBox="0 0 32 32">
<use xlink:href="#avatar" />
</svg>
</div>
<span class="chatbot__arrow chatbot__arrow--left"></span>
<p class='chatbot__message'><strong class='intro'>Hello, I’m Harry, your virtual assistant. I'm here to help with your general enquiries.</strong>Example of questions you can ask for demo purpose: <br><em>Hi / How are you? / I'd like some financial advice / Can you email me a statement? / Can I get a form? / How do I cancel my life insurance? </em></p>
</li>
<!-- Message here -->
</ul>
</div>
<div class="chatbot__entry chatbot--closed">
<input type="text" class="chatbot__input" placeholder="Write a message..." />
<svg class="chatbot__submit" viewBox="0 0 32 32">
<use xlink:href="#icon-send" />
</svg>
</div>
</div>
演示和完整代码如下:https://codepen.io/trendingnews/pen/wvBorrR?editors=1010
当用户在聊天机器人上点击关闭时,它会出现一个反馈模式来填充使用聊天机器人的用户体验。如果用户单击聊天机器人上的关闭图标,它将关闭聊天机器人。我希望当用户单击聊天机器人外部的元素时,聊天机器人也可以关闭
我该怎么做?
【问题讨论】:
-
已经有类似的问题了。这对你有帮助吗? stackoverflow.com/a/153047/12545040
-
@BrOsCoRe 好的。这个:
$(window).click(function() { //Hide the menus if visible });。正确的?但是当聊天机器人打开时,我如何运行该语句?所以如果聊天机器人关闭了,它就不会运行语句
标签: javascript jquery twitter-bootstrap bootstrap-4 bootstrap-modal