Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

65 Zeilen
1.9 KiB

vor 3 Jahren
  1. /**
  2. * 将layer.js的一些方法封装为showdoc常用的对话框.
  3. * 调用方法如$.window("https://www.showdoc.cc/","测试","50%","50%");
  4. */
  5. $(document).ready(function(){
  6. jQuery.extend({
  7. dialog_self:null,
  8. //加载url,弹出窗口
  9. window:function(url ,title , width ,height ,callback){
  10. if (!title) {
  11. title = '';
  12. };
  13. if (!width) {
  14. width = '40%';
  15. };
  16. if (!height) {
  17. height = '40%' ;
  18. };
  19. return layer.open({
  20. type: 2,
  21. title: title,
  22. shadeClose: true,
  23. shade: 0.8,
  24. area: [width, height],
  25. content: url ,//iframe的url
  26. end:callback
  27. });
  28. },
  29. //这是对应上面window()的关闭函数。window里面的iframe页面可以调用此方法来关闭自身
  30. close_self_window:function(){
  31. //假设这是iframe页
  32. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  33. return parent.layer.close(index); //再执行关闭
  34. },
  35. alert:function(content, options, yes){
  36. return layer.alert(content, options, yes)
  37. },
  38. confirm:function(content, options, yes, cancel){
  39. return layer.confirm(content, options, yes, cancel) ;
  40. },
  41. closeDialog:function(index){
  42. return layer.close(index) ;
  43. },
  44. closeAll:function(type){
  45. return layer.closeAll(type) ;
  46. },
  47. prompt:function(options, yes){
  48. return layer.prompt(options, yes);
  49. },
  50. msg:function(content, options, end){
  51. return layer.msg(content, options, end);
  52. },
  53. photos:function(options){
  54. return layer.photos(options);
  55. },
  56. });
  57. });