使用jQuery函数显示一个弹出窗口

Show a popup window using jQuery function

本文关键字:一个 窗口 jQuery 函数 显示 使用      更新时间:2023-09-26

我有一个需要通过JS/jQuery函数打开的弹出窗口,而不是按链接/按钮。现在按下链接就打开了。弹出代码如下:

<a id="testforStack" href="#chatWindow" data-rel="popup" class="ui-btn ui-btn-inline ui-corner-all">testforStack</a>
    <!-- Chat Window -->
      <div data-role="popup" id="chatWindow" class="ui-content">
      <a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn ui-icon-delete ui-btn-icon-notext ui-btn-left">Close</a>
        <!-- Text-->
        <div class="pure-g">
          <!-- Steps -->
          <div class="pure-u-1-3">
            <!-- Get local audio/video stream -->
            <div id="step1">
              <p>Please click `allow` on the top of the screen so we can access your webcam and microphone for calls.</p>
              <div id="step1-error">
                <p>Failed to access the webcam and microphone. Make sure to run this demo on an http server and click allow when asked for permission by the browser.</p>
                <a href="#" class="pure-button pure-button-error" id="step1-retry">Try again</a>
              </div>
            </div>
            <!-- Make calls to others -->
            <div id="step2">
              <p>Press Green Button to call <span id="my-id">...</span></p>
              <div class="pure-form">
                <input type="text" placeholder="Call user id..." id="callto-id">
                <a href="#" class="pure-button pure-button-success" id="make-call">Call</a>
              </div>
            </div>
            <!-- Call in progress -->
            <div id="step3">
              <p>Currently in call with <span id="their-id">...</span></p>
              <p><a href="#" class="pure-button pure-button-error" id="end-call">End call</a></p>
            </div>
          </div>
       </div>
        <!-- Video area -->
        <div class="pure-u-2-3" id="video-container">
            <video id="their-video" autoplay></video>
            <video id="my-video" muted="true" autoplay></video>
        </div>
    </div>

这相当简单。

$("#chatWindow").popup("open");