如何在页面加载/使用Javascript时自动打开仅限CSS的弹出窗口?

前端之家收集整理的这篇文章主要介绍了如何在页面加载/使用Javascript时自动打开仅限CSS的弹出窗口?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我创建了仅限CSS的弹出窗口,只能通过单击链接/按钮来工作.我想在页面加载时自动显示此弹出窗口.此外,如何在不点击链接/按钮的情况下打开此弹出窗口,即使用Javascript / jQuery.

Fiddle

  1. .modalDialog {
  2. position: fixed;
  3. top: 0;
  4. right: 0;
  5. bottom: 0;
  6. left: 0;
  7. z-index: 99999;
  8. opacity: 0;
  9. -webkit-transition: opacity 400ms ease-in;
  10. -moz-transition: opacity 400ms ease-in;
  11. transition: opacity 400ms ease-in;
  12. pointer-events: none;
  13. }
  14. .modalDialog:target {
  15. opacity: 1;
  16. pointer-events: auto;
  17. }
  18. .modalDialog > div {
  19. width: 400px;
  20. position: relative;
  21. margin: 10% auto;
  22. padding: 5px 20px 13px 20px;
  23. border-radius: 10px;
  24. background: #fff;
  25. background: #339999;
  26. }
  27. .close {
  28. background: #606061;
  29. color: #FFFFFF;
  30. line-height: 25px;
  31. position: absolute;
  32. right: -12px;
  33. text-align: center;
  34. top: -10px;
  35. width: 24px;
  36. text-decoration: none;
  37. font-weight: bold;
  38. -webkit-border-radius: 12px;
  39. -moz-border-radius: 12px;
  40. border-radius: 12px;
  41. -moz-Box-shadow: 1px 1px 3px #000;
  42. -webkit-Box-shadow: 1px 1px 3px #000;
  43. Box-shadow: 1px 1px 3px #000;
  44. }
  45. .close:hover {
  46. background: #00d9ff;
  47. }

提前致谢

最佳答案

猜你在找的HTML相关文章