Every line of 'show modal popup after time delay' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
82 function ShowModalPopup(modalPopupID) { 83 var popupID = "#" + modalPopupID; 84 var popupMarginTop = $(popupID).height() / 2; 85 var popupMarginLeft = $(popupID).width() / 2; 86 $('body').css('overflow', 'hidden'); 87 $(popupID).css({ 88 'left': '50%', 89 'top': '50%', 90 'margin-top': -popupMarginTop, 91 'margin-left': -popupMarginLeft, 92 'display': 'block', 93 'position': 'fixed', 94 'z-index': 99999 95 }); 96 97 var backgroundSelector = $('<div></div>'); 98 backgroundSelector.appendTo('body'); 99 100 backgroundSelector.css({ 101 'width': $(document).width(), 102 'height': $(document).height(), 103 'display': 'none', 104 'background-color': '#000', 105 'filter':'alpha(opacity=80)', 106 'position': 'absolute', 107 'top': 0, 108 'left': 0, 109 'z-index': 99998 110 }); 111 112 backgroundSelector.fadeTo('fast', 0.8); 113 backgroundSelector.click(function(){ 114 HideModalPopup(modalPopupID) 115 }); 116 117 }
110 hide () { 111 if (this.hideTimer) { 112 clearTimeout(this.hideTimer) 113 this.hideTimer = null 114 } 115 116 this.hideTimer = setTimeout(() => { 117 this.modal.classList.remove('show') 118 }, 0) 119 }
36 show(modal, callback) { 37 callback(); 38 }
149 function hidePopup() { 150 $("div.image-comparison").hide(); 151 $("div.screenshot-canvas").hide(); 152 hideShadow(); 153 $("#popup").fadeOut(); 154 }
67 export function hide (delay) { 68 delay = typeof delay === 'number' ? delay : 400 69 _tm = setTimeout(() => { 70 div.style.display = 'none' 71 div.className = '' 72 }, delay) 73 }
607 function closePopup() { 608 $('.popup').fadeOut(300); 609 }
63 openCustomDelay() { 64 this.delayMessages.push({ 65 content: 'Tip: This will hide after 5s!' 66 }) 67 }
175 function delayShow(delayTime, targetElement, options) { 176 // 移除老的绑在layer身上的事件 177 this.helper.removeDOMEvent(this.main, 'mouseover'); 178 this.helper.removeDOMEvent(this.main, 'mouseout'); 179 // 加上新的 180 this.helper.addDOMEvent( 181 this.main, 182 'mouseover', 183 u.partial( 184 this.show, targetElement, options 185 ) 186 ); 187 188 this.helper.addDOMEvent( 189 this.main, 190 'mouseout', 191 u.partial(delayHide, 150) 192 ); 193 194 if (delayTime) { 195 clearTimeout(this.showTimeout); 196 clearTimeout(this.hideTimeout); 197 this.showTimeout = setTimeout( 198 lib.bind(this.show, this, targetElement, options), 199 delayTime 200 ); 201 } 202 else { 203 this.show(targetElement, options); 204 } 205 }
138 autoDismissPopup(popupId: string, dismissDelay?: number): void { 139 if (popupId === this._activePopupId && this._activePopupOptions) { 140 if (this._popupShowDelayTimer) { 141 Timers.clearTimeout(this._popupShowDelayTimer); 142 this._popupShowDelayTimer = undefined; 143 } 144 145 this._activePopupAutoDismiss = true; 146 this._activePopupAutoDismissDelay = dismissDelay || 0; 147 this._renderRootView(); 148 } 149 }
9 function showPopup(popup) { 10 if (!popupQueue.length) { 11 popup.show(); 12 } 13 popupQueue.push(popup); 14 }