bootstrap.js 1.3 KB

123456789101112131415161718192021222324252627
  1. require(['fast', 'layer'], function (Fast, Layer) {
  2. var _fastOpen = Fast.api.open;
  3. Fast.api.open = function (url, title, options) {
  4. options = options || {};
  5. options.area = Config.betterform.area;
  6. options.offset = Config.betterform.offset;
  7. options.anim = Config.betterform.anim;
  8. options.shadeClose = Config.betterform.shadeClose;
  9. options.shade = Config.betterform.shade;
  10. return _fastOpen(url, title, options);
  11. };
  12. if (isNaN(Config.betterform.anim)) {
  13. var _layerOpen = Layer.open;
  14. Layer.open = function (options) {
  15. var classNameArr = {slideDown: "layer-anim-slide-down", slideLeft: "layer-anim-slide-left", slideUp: "layer-anim-slide-up", slideRight: "layer-anim-slide-right"};
  16. var animClass = "layer-anim " + classNameArr[options.anim] || "layer-anim-fadein";
  17. var index = _layerOpen(options);
  18. var layero = $('#layui-layer' + index);
  19. layero.addClass(classNameArr[options.anim] + "-custom");
  20. layero.addClass(animClass).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
  21. $(this).removeClass(animClass);
  22. });
  23. return index;
  24. }
  25. }
  26. });