This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if($(element).is(':hover')) { do something } | |
| function handler( event ) { | |
| var target = $( event.target ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function preventMacBackFwdGesture(element, scrollable) { | |
| if (scrollable === undefined) { | |
| var scrollable = true; | |
| }; | |
| $(element).each(function () { | |
| var $this = $(this); | |
| var scrollDirection; | |
| $this.mousewheel(function(event, delta, deltaX, deltaY) { | |
| if (Math.abs(deltaX) < Math.abs(deltaY)) { | |
| scrollDirection = "vertical"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Firefox 14.0.1 | |
| window.retina => undefined | |
| window.devicePixelRatio => undefined | |
| Chrome 21.0.1180.57 | |
| window.devicePixelRatio => 2 | |
| window.retina => undefined | |
| Safari 6.0 (8536.25) | |
| window.retina => true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var MobileDetect = function() { | |
| if (navigator.userAgent.match(/Android/i) | |
| || navigator.userAgent.match(/webOS/i) | |
| || navigator.userAgent.match(/iPhone/i) | |
| || navigator.userAgent.match(/iPad/i) | |
| || navigator.userAgent.match(/iPod/i) | |
| || navigator.userAgent.match(/BlackBerry/i) | |
| || navigator.userAgent.match(/Windows Phone/i) | |
| ){ | |
| return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const double ALPHA = 0.05; | |
| resultSpeed = ALPHA * currentSpeed + (1.0 - ALPHA) * resultSpeed; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var clickOrTouch = (('ontouchend' in window)) ? 'touchend' : 'click'; | |
| $('#element').on(clickOrTouch, function() { | |
| // do something | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define(('__proto__' in {} ? ['zepto'] : ['jquery']), function($) { | |
| return $; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function randomArray(array){ | |
| function swap(obj, a, b) { | |
| var tmp = obj[a]; | |
| obj[a] = obj[b]; | |
| obj[b] = tmp; | |
| } | |
| var length = array.length; | |
| var rand = function(){ | |
| return Math.round(Math.random() * (length - 1)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> | |
| <link href="./css/index.css" rel="stylesheet" type="text/css" /> | |
| <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
| <script type="text/javascript"> | |
| $(document).ready(function() { | |
| $("#enzan").click( function() { | |
| var a = $("#start").val(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var n = 9 | |
| var r = n/2 | |
| function range(i){ | |
| var left = -r + i | |
| var right = -r + i + 1 | |
| if( left < - r ){ | |
| left = -r | |
| } |
OlderNewer