(function($) { 'use strict'; // bootstrap dropdown hover $('nav .dropdown').hover(function(){ var $this = $(this); // timer; // clearTimeout(timer); $this.addClass('show'); $this.find('> a').attr('aria-expanded', true); // $this.find('.dropdown-menu').addClass('animated-fast fadeInUp show'); $this.find('.dropdown-menu').addClass('show'); }, function(){ var $this = $(this); // timer; // timer = setTimeout(function(){ $this.removeClass('show'); $this.find('> a').attr('aria-expanded', false); // $this.find('.dropdown-menu').removeClass('animated-fast fadeInUp show'); $this.find('.dropdown-menu').removeClass('show'); // }, 100); }); $('#dropdown04').on('show.bs.dropdown', function () { console.log('show'); }); // home slider $('.home-slider').owlCarousel({ loop:true, autoplay: true, margin:10, animateOut: 'fadeOut', animateIn: 'fadeIn', nav:true, autoplayHoverPause: true, items: 1, navText : ["",""], responsive:{ 0:{ items:1, nav:false }, 600:{ items:1, nav:false }, 1000:{ items:1, nav:true } } }); // owl carousel var majorCarousel = $('.js-carousel-1'); majorCarousel.owlCarousel({ loop:true, autoplay: true, stagePadding: 7, margin: 20, animateOut: 'fadeOut', animateIn: 'fadeIn', nav: true, autoplayHoverPause: true, items: 3, navText : ["",""], responsive:{ 0:{ items:1, nav:false }, 600:{ items:2, nav:false }, 1000:{ items:3, nav:true, loop:false } } }); // owl carousel var major2Carousel = $('.js-carousel-2'); major2Carousel.owlCarousel({ loop:true, autoplay: true, stagePadding: 7, margin: 20, animateOut: 'fadeOut', animateIn: 'fadeIn', nav: true, autoplayHoverPause: true, items: 4, navText : ["",""], responsive:{ 0:{ items:1, nav:false }, 600:{ items:3, nav:false }, 1000:{ items:4, nav:true, loop:false } } }); $('#appointment_date').datepicker({ 'format': 'm/d/yyyy', 'autoclose': true }); $('#appointment_time').timepicker(); var contentWayPoint = function() { var i = 0; $('.element-animate').waypoint( function( direction ) { if( direction === 'down' && !$(this.element).hasClass('element-animated') ) { i++; $(this.element).addClass('item-animate'); setTimeout(function(){ $('body .element-animate.item-animate').each(function(k){ var el = $(this); setTimeout( function () { var effect = el.data('animate-effect'); if ( effect === 'fadeIn') { el.addClass('fadeIn element-animated'); } else if ( effect === 'fadeInLeft') { el.addClass('fadeInLeft element-animated'); } else if ( effect === 'fadeInRight') { el.addClass('fadeInRight element-animated'); } else { el.addClass('fadeInUp element-animated'); } el.removeClass('item-animate'); }, k * 100); }); }, 100); } } , { offset: '95%' } ); }; contentWayPoint(); })(jQuery); function Drag() { //鍒濆鍖 this.initialize.apply(this, arguments) } Drag.prototype = { //鍒濆鍖 initialize : function (drag, options) { this.drag = this.$(drag); this._x = this._y = 0; this._moveDrag = this.bind(this, this.moveDrag); this._stopDrag = this.bind(this, this.stopDrag); this.setOptions(options); this.handle = this.$(this.options.handle); this.maxContainer = this.$(this.options.maxContainer); this.maxTop = Math.max(this.maxContainer.clientHeight, this.maxContainer.scrollHeight) - this.drag.offsetHeight; this.maxLeft = Math.max(this.maxContainer.clientWidth, this.maxContainer.scrollWidth) - this.drag.offsetWidth; this.limit = this.options.limit; this.lockX = this.options.lockX; this.lockY = this.options.lockY; this.lock = this.options.lock; this.onStart = this.options.onStart; this.onMove = this.options.onMove; this.onStop = this.options.onStop; this.handle.style.cursor = "move"; this.changeLayout(); this.addHandler(this.handle, "mousedown", this.bind(this, this.startDrag)) }, changeLayout : function () { this.drag.style.top = this.drag.offsetTop + "px"; this.drag.style.left = this.drag.offsetLeft + "px"; this.drag.style.position = "absolute"; this.drag.style.margin = "0" }, startDrag : function (event) { var event = event || window.event; this._x = event.clientX - this.drag.offsetLeft; this._y = event.clientY - this.drag.offsetTop; this.addHandler(document, "mousemove", this._moveDrag); this.addHandler(document, "mouseup", this._stopDrag); event.preventDefault && event.preventDefault(); this.handle.setCapture && this.handle.setCapture(); this.onStart() }, moveDrag : function (event) { var event = event || window.event; var iTop = event.clientY - this._y; var iLeft = event.clientX - this._x; if (this.lock) return; this.limit && (iTop < 0 && (iTop = 0), iLeft < 0 && (iLeft = 0), iTop > this.maxTop && (iTop = this.maxTop), iLeft > this.maxLeft && (iLeft = this.maxLeft)); this.lockY || (this.drag.style.top = iTop + "px"); this.lockX || (this.drag.style.left = iLeft + "px"); event.preventDefault && event.preventDefault(); this.onMove() }, stopDrag : function () { this.removeHandler(document, "mousemove", this._moveDrag); this.removeHandler(document, "mouseup", this._stopDrag); this.handle.releaseCapture && this.handle.releaseCapture(); this.onStop() }, //鍙傛暟璁剧疆 setOptions : function (options) { this.options = { handle: this.drag, //浜嬩欢瀵硅薄 limit: true, //閿佸畾鑼冨洿 lock: false, //閿佸畾浣嶇疆 lockX: false, //閿佸畾姘村钩浣嶇疆 lockY: false, //閿佸畾鍨傜洿浣嶇疆 maxContainer: document.documentElement || document.body, //鎸囧畾闄愬埗瀹瑰櫒 onStart: function () {}, //寮€濮嬫椂鍥炶皟鍑芥暟 onMove: function () {}, //鎷栨嫿鏃跺洖璋冨嚱鏁 onStop: function () {} //鍋滄鏃跺洖璋冨嚱鏁 }; for (var p in options) this.options[p] = options[p] }, //鑾峰彇id $ : function (id) { return typeof id === "string" ? document.getElementById(id) : id }, //娣诲姞缁戝畾浜嬩欢 addHandler : function (oElement, sEventType, fnHandler) { return oElement.addEventListener ? oElement.addEventListener(sEventType, fnHandler, false) : oElement.attachEvent("on" + sEventType, fnHandler) }, //鍒犻櫎缁戝畾浜嬩欢 removeHandler : function (oElement, sEventType, fnHandler) { return oElement.removeEventListener ? oElement.removeEventListener(sEventType, fnHandler, false) : oElement.detachEvent("on" + sEventType, fnHandler) }, //缁戝畾浜嬩欢鍒板璞 bind : function (object, fnHandler) { return function () { return fnHandler.apply(object, arguments) } } }; //搴旂敤 window.onload = function () { var oBox = document.getElementById("box"); var oTitle = oBox.getElementsByTagName("h2")[0]; var oSpan = document.getElementsByTagName("span")[0]; var oDrag = new Drag(oBox, {handle:oTitle, limit:false}); var aInput = document.getElementsByTagName("input"); //閿佸畾鑼冨洿鎺ュ彛 aInput[0].onclick = function () { oDrag.limit = !oDrag.limit; this.value = oDrag.limit ? "鍙栨秷閿佸畾鑼冨洿" : "閿佸畾鑼冨洿" }; //姘村钩閿佸畾鎺ュ彛 aInput[1].onclick = function () { oDrag.lockX = !oDrag.lockX; this.value = oDrag.lockX ? "鍙栨秷姘村钩閿佸畾" : "姘村钩閿佸畾" }; //鍨傜洿閿佸畾鎺ュ彛 aInput[2].onclick = function () { oDrag.lockY = !oDrag.lockY; this.value = oDrag.lockY ? "鍙栨秷鍨傜洿閿佸畾" : "鍨傜洿閿佸畾" }; //閿佸畾浣嶇疆鎺ュ彛 aInput[3].onclick = function () { oDrag.lock = !oDrag.lock; this.value = oDrag.lock ? "鍙栨秷閿佸畾浣嶇疆" : "閿佸畾浣嶇疆" }; //寮€濮嬫嫋鎷芥椂鏂规硶 oDrag.onStart = function () { oSpan.innerHTML = "寮€濮嬫嫋鎷? }; //寮€濮嬫嫋鎷芥椂鏂规硶 oDrag.onMove = function () { oSpan.innerHTML = "left:" + this.drag.offsetLeft + ", top:" + this.drag.offsetTop }; //寮€濮嬫嫋鎷芥椂鏂规硶 oDrag.onStop = function () { oSpan.innerHTML = "缁撴潫鎷栨嫿" }; };