我正在寻找一种弹出窗口

时间:2014-12-30 20:25:22

标签: javascript jquery popup

我在谷歌寻找某种弹出窗口。让我们说当我按下某个东西时会出现一个小小的云,它会在几秒钟后或者我点击的任何地方消失。 怎么叫???谷歌中的所有弹出/模态窗口脚本都很像屏幕大小,使页面的其余部分消失或需要按X才能关闭它。 我应该在谷歌中输入什么来找到这样的东西?

1 个答案:

答案 0 :(得分:-1)

你可以制作一个div并使用display:none设置;和z-index:99999; 要显示弹出窗口,您可以使用jquery.show()。 这样的事情:

HTML代码:

 <html>
      <body>
    <div id="popup">
      <p>popup content</p>
      <button type="button" id="closePopup">Close D:</button>
    </div>
    <p>This is the content of the website</p>
    <button type="button" id="openPopup">Open popup :D</button>
  </body>
</html>

CSS

body{
  background-color:#ddd;
}

#popup{
  height:100px;
  width:100px;
  border:1px solid #444;
  position:absolute;
  margin:20px 0px 0px 300px;
  background-color:#222;
  color:#ddd;
  box-shadow: 3px 3px 10px 1px #444;
  z-index:99999;
  display:none;
}

JS(jQuery)

$('#openPopup').click(function(event){
  $('#popup').show();
});

$('#closePopup').click(function(event){
  $('#popup').hide();
});

Link to codepen

原谅我的英语。