/*! * Base Script v0.1 * https://github.com/eterv/base.js * @license MIT licensed * * Copyright (C) 2018 eterv.com - A project by Gwang-won Choi */ /** * Minified by jsDelivr using UglifyJS v3.4.2. * Original file: /npm/js-cookie@2.2.0/src/js.cookie.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ !function(e){var n=!1;if("function"==typeof define&&define.amd&&(define(e),n=!0),"object"==typeof exports&&(module.exports=e(),n=!0),!n){var o=window.Cookies,t=window.Cookies=e();t.noConflict=function(){return window.Cookies=o,t}}}(function(){function g(){for(var e=0,n={};e0&&(e=e[0]);var i=new t(e,this);return i.setStateFromDOM(),i.listenToDOM(),i},t.prototype.create=function(t,e){"string"==typeof t?t=document.querySelector(t):t&&t.length>0&&(t=t[0]);var i=new p(this,t,e);return this.watchers.push(i),i},t.prototype.beget=function(t,e){return this.create(t,e)},t}();t.exports=f},function(t,e,i){"use strict";function o(t,e,i){function o(t,e){if(0!==t.length)for(E=t.length;E--;)y=t[E],y.callback.call(s,e,s),y.isOne&&t.splice(E,1)}var s=this;this.watchItem=e,this.container=t,i?i===+i?this.offsets={top:i,bottom:i}:this.offsets={top:i.top||w.top,bottom:i.bottom||w.bottom}:this.offsets=w,this.callbacks={};for(var d=0,f=u.length;d0?this.top=this.bottom=this.watchItem:this.top=this.bottom=this.container.documentHeight-this.watchItem:(this.top=this.watchItem.top,this.bottom=this.watchItem.bottom);this.top-=this.offsets.top,this.bottom+=this.offsets.bottom,this.height=this.bottom-this.top,void 0===t&&void 0===e||this.top===t&&this.bottom===e||o(this.callbacks[l],null)}},this.recalculateLocation(),this.update(),m=this.isInViewport,v=this.isFullyInViewport,b=this.isAboveViewport,I=this.isBelowViewport}var s=i(1),n=s.VISIBILITYCHANGE,r=s.ENTERVIEWPORT,h=s.FULLYENTERVIEWPORT,c=s.EXITVIEWPORT,a=s.PARTIALLYEXITVIEWPORT,l=s.LOCATIONCHANGE,p=s.STATECHANGE,u=s.eventTypes,w=s.defaultOffsets;o.prototype={on:function(t,e,i){switch(!0){case t===n&&!this.isInViewport&&this.isAboveViewport:case t===r&&this.isInViewport:case t===h&&this.isFullyInViewport:case t===c&&this.isAboveViewport&&!this.isInViewport:case t===a&&this.isInViewport&&this.isAboveViewport:if(e.call(this,this.container.latestEvent,this),i)return}if(!this.callbacks[t])throw new Error("Tried to add a scroll monitor listener of type "+t+". Your options are: "+u.join(", "));this.callbacks[t].push({callback:e,isOne:i||!1})},off:function(t,e){if(!this.callbacks[t])throw new Error("Tried to remove a scroll monitor listener of type "+t+". Your options are: "+u.join(", "));for(var i,o=0;i=this.callbacks[t][o];o++)if(i.callback===e){this.callbacks[t].splice(o,1);break}},one:function(t,e){this.on(t,e,!0)},recalculateSize:function(){this.height=this.watchItem.offsetHeight+this.offsets.top+this.offsets.bottom,this.bottom=this.top+this.height},update:function(){this.isAboveViewport=this.topthis.container.viewportBottom,this.isInViewport=this.topthis.container.viewportTop,this.isFullyInViewport=this.top>=this.container.viewportTop&&this.bottom<=this.container.viewportBottom||this.isAboveViewport&&this.isBelowViewport},destroy:function(){var t=this.container.watchers.indexOf(this),e=this;this.container.watchers.splice(t,1);for(var i=0,o=u.length;i= viewTop) && (eleTop <= viewBottom)) { if (!d_visible) { d_visible = true; $this.data('visible', d_visible); $(this).css('visibility', 'visible'); $(this).removeClass(d_aniout); $(this).addClass(d_ani); $(this).addClass('animated'); //console.log('들어왔다.'); } } else { if (opt.once === false) { if (d_visible) { d_visible = false; $this.data('visible', d_visible); /*$(this).css('visibility', 'hidden');*/ $(this).removeClass(d_ani); $(this).addClass(d_aniout); //$(this).removeClass('animated'); } } //console.log('나갔다.'); } /* var eleHeight = $this.outerHeight(); var eleTop = $this.offset().top; var eleBottom = (eleTop + eleHeight); if (d_offset) { eleTop = eleTop + d_offset; eleBottom = eleBottom - d_offset; } if ((eleBottom >= viewTop) && (eleTop <= viewBottom)) { $(this).css('visibility', 'visible'); //$(this).removeClass(d_aniout); $(this).addClass(d_ani); $(this).addClass('animated'); //console.log('들어왔다.'); } else { if (opt.once === false) { $(this).removeClass(d_ani); //$(this).removeClass(d_aniout); $(this).removeClass('animated'); $(this).css('visibility', 'hidden'); } //console.log('나갔다.'); }*/ }); } }; jQuery.fn.Reveald = function(opt) { var $ele = this; opt = $.extend({ // Default Options mobile: true, once: false, ani: 'fadeInUp', aniout: 'fadeOutDown', offset: 0, delay: '0', duration: '1s', iteration: '1' }, opt); if (opt.mobile === false) { if(/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) return false; } this.each(function() { var $this = $(this); var d_ani = $this.data('ani'); var d_aniout = $this.data('aniout'); var d_offset = $this.data('offset'); var d_delay = $this.data('delay'); var d_duration = $this.data('duration'); var d_iteration = $this.data('iteration'); if (typeof d_ani === 'undefined') d_ani = opt.ani; if (typeof d_aniout === 'undefined') d_aniout = opt.aniout; if (typeof d_offset === 'undefined') d_offset = opt.offset; if (typeof d_delay === 'undefined') d_delay = opt.delay; if (typeof d_duration === 'undefined') d_duration = opt.duration; if (typeof d_iteration === 'undefined') d_iteration = opt.iteration; $this.data('ani', d_ani); $this.data('aniout', d_aniout); $this.data('offset', d_offset); $this.css({ '-webkit-animation-duration': d_duration, 'animation-duration': d_duration, '-webkit-animation-delay': d_delay, 'animation-delay': d_delay, '-webkit-animation-iteration-count': d_iteration, 'animation-iteration-count': d_iteration }); $(document).ready(function() { var watcher = window.scrollMonitor.create($this); watcher.enterViewport(function() { $this.css('visibility', 'visible'); $this.removeClass(d_aniout); $this.addClass(d_ani); $this.addClass('animated'); }); watcher.exitViewport(function() { $this.removeClass(d_ani); $this.addClass(d_aniout); }); }); }); var rid = getRandomID(); // Attach Events $window.on('scroll resize', function() { waitForFinalEvent(function() { Reveald.Animate($ele, opt); }, 50, rid); }); $window.trigger('scroll'); //return this.each(function() {}); }; })(window.jQuery);