We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
还是喜欢旧版的弹层抖动功能
喜欢的可以参考一下。V6很简洁支持AMD很赞。
V6
把4.1.2种的实验性扩展源码复制到dialog.js中。
dialog.js
我这里放到
_trigger:function (id) { ... }
后面
/** * 震动模式 * 参考:http://www.planeart.cn/demo/artDialog/_doc/labs.html */ shake: function(){ var timerId = null; var style = this._popup[0].style, p = [4, 8, 4, 0, -4, -8, -4, 0], fx = function () { style.marginLeft = p.shift() + 'px'; if (p.length <= 0) { style.marginLeft = 0; clearInterval(timerId); }; }; p = p.concat(p.concat(p.concat(p))); timerId = setInterval(fx, 5); return this; },
需修改popup.js中的show函数
popup.js
show
show: function (anchor, fn) { ... // this.reset().focus(); typeof fn == "function" ? fn() : this.reset().focus(); ... }
还是在dialog.js中进行扩展
/** * 下滑出现 */ slideDown: function(){ var that = this; var wh = $(window).height(); var oh = that._popup.height(); var dt = this.fixed ? 0 : $(document).scrollTop(); var top = (wh - oh) * 382 / 1000 + dt; that._popup.css({ top: -(wh + oh) }); this.show(null, function(){ that._popup.animate({ top: Math.max(parseInt(top), dt) }, 500); }); return this; }, /** * 上滑消失 */ slideUp: function(remove) { var that = this; var wh = $(window).height(); var oh = that._popup.height(); that._popup.animate({ top: -(wh + oh) }, 600, function(){ remove ? that.close().remove() : that.close(); }); return this; }
dialog-plus.js
The text was updated successfully, but these errors were encountered:
同样觉得这个抖动有用,之前就自己扩展进去了
Sorry, something went wrong.
/* * 修改 扩展shake摇头方法 */ $.extend(dialog.create.prototype,{ shake: function(){ var timerId = null; var style = this._popup[0].style, p = [4, 8, 4, 0, -4, -8, -4, 0], fx = function () { style.marginLeft = p.shift() + 'px'; if (p.length <= 0) { style.marginLeft = 0; clearInterval(timerId); }; }; p = p.concat(p.concat(p.concat(p))); timerId = setInterval(fx, 8); return this; } });
可以直接扩展$.extend(dialog.create.prototype,{shake:function(){}}),然后使用的时候就可以像内部函数一样使用了
No branches or pull requests
还是喜欢旧版的弹层抖动功能
喜欢的可以参考一下。
V6
很简洁支持AMD很赞。动手
把4.1.2种的实验性扩展源码复制到
dialog.js
中。我这里放到
后面
上滑下滑出现扩展
需修改
popup.js
中的show
函数还是在
dialog.js
中进行扩展建议通过模块扩展方法类似于
dialog-plus.js
来拓展不要去修改源码The text was updated successfully, but these errors were encountered: