123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- $(function () {
- 'use strict';
- window.utils = window.utils || {};
- window.utils.popup = {
- createAnimation: function () {
- return {
- show: { type: "pop", duration: 200, from: { opacity: 1, scale: 0.4 }, to: { scale: 1 } },
- hide: { type: "fade", duration: 200, from: 1, to: 0 }
- }
- },
- getAttachFunc: function (selectString, timerObj, position) {
- return function (value) {
- if (value) {
- if (timerObj.timer !== null) {
- clearInterval(timerObj.timer);
- }
- var top, left;
- var element = $(selectString).offsetParent();
- position({ my: 'left top', at: 'right top', of: element });
- timerObj.timer = setInterval(function () {
- element = $(selectString).offsetParent();
- var offset = element.offset();
- if (top !== offset.top || left !== offset.left) {
- top = offset.top;
- left = offset.left;
- position({ my: 'left top', at: 'right top', of: element });
- }
- }, 0);
- }
- else {
- if (timerObj.timer !== null) {
- clearInterval(timerObj.timer);
- timerObj.timer = null;
- }
- }
- };
- }
- };
- });
|