显示/隐藏<p:通知栏>使用相同的快捷方式<p:hotkey>

Display/Hide <p:notificationBar > with the same shortcut <p:hotkey>

本文关键字:hotkey 快捷方式 通知 隐藏 显示      更新时间:2023-09-26

我想隐藏/显示快捷方式<p:hotkey>,我成功隐藏在jQuery代码中并<p:hotkey>,如何使用相同的键显示它?

  <script>
          jQuery(document).ready(function($) {
               $(window).click(function () {
                                         PF('bar').hide();
                                           });
                $(window).blur(function () {
                 PF('bar').hide();
                                           });
                                              });
     </script>

.xhtml:

<p:notificationBar autoDisplay="true"  position="top" effect="slide" widgetVar="bar"   style="z-index: 1500;opacity: .98">  
                    <center>
                        <h:outputText value="Select Bank and press Ctrl , + to add agency" style="color:red;font-size:14px;" /><br/><br/>
                        <h:outputText value="Click anywhere or press SPACE to hide this bar" style="color:red;font-size:14px;" />
                    </center> 
                </p:notificationBar>
                <p:hotkey bind="space"  onsuccess="PF('bar').hide()"/>

尝试使用

bar.toggel();

它应该工作