//TODO: remove if IE no problem ////if ($.browser.msie) { // var v = parseInt($.browser.version, 10); // if (v <= 8) { // delete JSON; // } //} /* $(document).on('mobileinit', function() { 'use strict'; $.mobile.ajaxEnabled = false; $.mobile.hashListeningEnabled = false; $.mobile.linkBindingEnabled = false; }); */ //$(function() { $(document).on('pageinit', function() { 'use strict'; setTimeout(function() { $('.initial-logo').fadeOut(1000, function() { location.href = 'content.php'; // roll out menu buttons animation var i = 0; $('.one-menu-button').each(function() { var $this = $(this), time = 600; setTimeout(function() { $this.effect('slide', {}, time); }, time * i); i++; }); // setTimeout(function() { // var i = 0; // $('.one-menu-button').each(function() { // i++; // $(this).effect('slide', {}, 1000 * i); // }); // }, 2000); }); }, 5000); }); // swipeup & swipedown // http://maiagallo.blogspot.hk/2012/12/jquery-mobile-adding-swipe-up-and-swipe.html (function() { // initializes touch and scroll events var supportTouch = $.support.touch, scrollEvent = "touchmove scroll", touchStartEvent = supportTouch ? "touchstart" : "mousedown", touchStopEvent = supportTouch ? "touchend" : "mouseup", touchMoveEvent = supportTouch ? "touchmove" : "mousemove"; // handles swipeup and swipedown $.event.special.swipeupdown = { setup: function() { var thisObject = this; var $this = $(thisObject); $this.bind(touchStartEvent, function(event) { var data = event.originalEvent.touches ? event.originalEvent.touches[ 0 ] : event, start = { time: (new Date).getTime(), coords: [ data.pageX, data.pageY ], origin: $(event.target) }, stop; function moveHandler(event) { if (!start) { return; } var data = event.originalEvent.touches ? event.originalEvent.touches[ 0 ] : event; stop = { time: (new Date).getTime(), coords: [ data.pageX, data.pageY ] }; // prevent scrolling if (Math.abs(start.coords[1] - stop.coords[1]) > 10) { event.preventDefault(); } } $this .bind(touchMoveEvent, moveHandler) .one(touchStopEvent, function(event) { $this.unbind(touchMoveEvent, moveHandler); if (start && stop) { if (stop.time - start.time < 1000 && Math.abs(start.coords[1] - stop.coords[1]) > 30 && Math.abs(start.coords[0] - stop.coords[0]) < 75) { start.origin .trigger("swipeupdown") .trigger(start.coords[1] > stop.coords[1] ? "swipeup" : "swipedown"); } } start = stop = undefined; }); }); } }; //Adds the events to the jQuery events special collection $.each({ swipedown: "swipeupdown", swipeup: "swipeupdown" }, function(event, sourceEvent){ $.event.special[event] = { setup: function(){ $(this).bind(sourceEvent, $.noop); } }; }); })();