Skip to content

Instantly share code, notes, and snippets.

View sundaycrafts's full-sized avatar

sundaycrafts

View GitHub Profile
@sundaycrafts
sundaycrafts / responsiveYoutubeVideo.scss
Last active August 29, 2015 14:21
css: responsive youtube video
http://h2ham.net/youtube-responsive
.youtube {
position: relative;
width: 100%;
padding-top: 56.25%; // it is aspect ratio. padding respect to the width
iframe {
position: absolute;
top: 0;
left: 0;
@sundaycrafts
sundaycrafts / scrollableElement.js
Last active August 29, 2015 14:21
scrollableElement.js
// http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links
function scrollableElement(els) {
for(var i = 0, len = arguments.length; i < len; i++) {
var el = arguments[i],
$scrollElement = $(el);
if($scrollElement.scrollTop() > 0) {
return el;
} else {
$scrollElement.scrollTop(1);
@sundaycrafts
sundaycrafts / preventPullToRefresh.js
Created May 23, 2015 06:16
prevent pull to refresh mobile chrome feature
/**
* inspired by jdduke (http://jsbin.com/qofuwa/2/edit)
*/
var preventPullToRefresh = (function preventPullToRefresh(lastTouchY) {
lastTouchY = lastTouchY || 0;
var maybePrevent = false;