javascript代码实例教程-jQuery 弹出层 弹出对话框

发布时间:2019-02-02 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了javascript代码实例教程-jQuery 弹出层 弹出对话框脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
小宝典致力于为广大程序猿(媛)提供高品质的代码服务,请大家多多光顾小站,小宝典在此谢过。

jQuery 弹出层 弹出对话

可以设置大小,ajax内容弹出,背景等各种调整

javascript代码实例教程-jQuery 弹出层 弹出对话框

演示

XML/HTML Code
    @H_360_11@





  1. <script>
  2. $(document).ready(function() {
  3. @L_777_1@yLightbox.inIT({
  4. override:true,
  5. background: 'white',
  6. centerOnReSize: true,
  7. fade: true
  8. });
  9. $('#alert').click(function() {
  10. alert('Hello');
  11. });
  12. $('#hello').click(function() {
  13. alert('Hello there, my name is ClassyLightbox. Pleasure meeting you.');
  14. });
  15. $('#ajax').click(function() {
  16. ClassyLightbox.alert({
  17. width: '400px',
  18. title: 'Ajax Content',
  19. rightButtons: ['OK'],
  20. leftButtons: ['Close'],
  21. oPEned: function() {
  22. $('').load('demo.html').appendTo('#lbContent');
  23. },
  24. onClick: function(button) {
  25. console.LOG(button);
  26. }
  27. });
  28. });
  29. $('#buttons').click(function() {
  30. ClassyLightbox.alert({
  31. width: '400px',
  32. title: 'Button Callbacks',
  33. rightButtons: ['No', 'Yes'],
  34. leftButtons: ['Close'],
  35. opened: function() {
  36. $('').html("rightButtons: ['No', 'Yes'],
    leftButtons: ['Close']
    ").appendTo('#lbContent');
  37. },
  38. onClick: function(button) {
  39. if (button != 'Close') {
  40. $('#ClassyLightbox #lbContent').append('
    Clicked '+button);
  41. }
  42. console.log(button);
  43. }
  44. });
  45. });
  46. $('#small').click(function() {
  47. ClassyLightbox.alert({
  48. width: '200px',
  49. title: '200px',
  50. rightButtons: ['OK'],
  51. opened: function() {
  52. $('').html("I am Small.
    width: '200px',").appendTo('#lbContent');
  53. },
  54. onClick: function(button) {
  55. console.log(button);
  56. }
  57. });
  58. });
  59. $('#Draggable').click(function() {
  60. ClassyLightbox.alert({
  61. width: '400px',
  62. title: 'Drag Me Up Here!',
  63. rightButtons: ['Cool!'],
  64. opened: function(){
  65. $('').html("If jquery UI is loaded, all windows will become draggable automagically!").appendTo('#lbContent');
  66. },
  67. onClick: function(button) {
  68. console.log(button);
  69. if (button == 'Cool!') {
  70. ClassyLightbox.clear();
  71. }
  72. }
  73. });
  74. });
  75. $('#wbgf').click(function() {
  76. ClassyLightbox.destroy();
  77. ClassyLightbox.init({
  78. override:true,
  79. background: 'white',
  80. centerOnResize: false,
  81. fade: true
  82. });
  83. alert("Hello World");
  84. });
  85. $('#bbgf').click(function() {
  86. ClassyLightbox.destroy();
  87. ClassyLightbox.init({
  88. override:true,
  89. background: 'black',
  90. centerOnResize: false,
  91. fade: true
  92. });
  93. alert("Hello World");
  94. });
  95. $('#bbg').click(function() {
  96. ClassyLightbox.destroy();
  97. ClassyLightbox.init({
  98. override:true,
  99. background: ((Math.ceil(Math.random()*2))==2) ? 'white' : 'black',
  100. centerOnResize: false,
  101. fade: false
  102. });
  103. alert("My background doesn't have to fade in, it can be distracting at times.");
  104. });
  105. $('#nobg').click(function() {
  106. ClassyLightbox.destroy();
  107. ClassyLightbox.init({
  108. override:true,
  109. background: 'none',
  110. centerOnResize: true,
  111. fade:false
  112. });
  113. alert("I have no background");
  114. });
  115. $('#center').click(function() {
  116. ClassyLightbox.destroy();
  117. ClassyLightbox.init({
  118. override:true,
  119. background:'white',
  120. centerOnResize: true,
  121. fade: false
  122. });
  123. alert("Resize the window when I am open! I stay centered on resize.");
  124. });
  125. });
  126. </script>

  127. 原文地址:https://www.freejs.net/article_jquerywenzi_137.html

    觉得可用,就经常来吧! 脚本宝典 欢迎评论哦!&nbsp;js脚本,巧夺天工,精雕玉琢。小宝典献丑了!

    脚本宝典总结

    以上是脚本宝典为你收集整理的javascript代码实例教程-jQuery 弹出层 弹出对话框全部内容,希望文章能够帮你解决javascript代码实例教程-jQuery 弹出层 弹出对话框所遇到的问题。

    如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

    本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
    如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。