To give a faded text look at the bottom of a long list, with gradient left and right borders (bottom to top) that act as a container.
.view-more
and .accordion-toggle
are separate divs that stack as siblings.
# Use Gists to store entire functions | |
class QuickSort | |
def self.sort!(keys) | |
quick(keys,0,keys.size-1) | |
end | |
private | |
def self.quick(keys, left, right) |
var customInterval = null; | |
function changeText(elem, text) { | |
// 'text' is a array of strings | |
// For example: ['loading','.loading.','..loading..','...loading...'] | |
var counter = 0; | |
customInterval = setInterval(change, 1000); | |
function change() { | |
elem.text(text[counter]); | |
counter++; |
jQuery.extend({ | |
getQueryParameters : function(str) { | |
return (str || document.location.search).replace(/(^\?)/,'').split("&").map(function(n){return n = n.split("="),this[n[0]] = n[1],this}.bind({}))[0]; | |
} | |
}); |
function scrollTo(element, within) { | |
$(within).bind('mousedown DOMMouseScroll mousewheel', function(){ | |
$(this).stop(); | |
}); | |
$(within).animate({ | |
scrollTop: Math.ceil($(element).position().top) | |
}, 1500, "easeOutQuart", function(){ | |
$(this).unbind('mousedown DOMMouseScroll mousewheel'); | |
}); |
function addError(element) { $(element).addClass('error'); } | |
function removeError(element) { $(element).removeClass('error'); } | |
function formatForUrl(str) { | |
return str | |
.replace(/ /g, '%20') | |
.replace(/:/g, '%20') | |
.replace(/\\/g, '-') | |
.replace(/\//g, '-') |
function removeFromArray(value, array) { | |
return $.grep(array, function(elem, index) { | |
return elem !== value; | |
}); | |
} |
$(document).ready(function(){ | |
$('.view-desktop-version') | |
.click(function(){ | |
var date = new Date(); | |
date.setTime(date.getTime() + (60 * 60 * 1000)); | |
$.cookie('page_ver', 'desktop', { expires: date, path: '/' }); | |
window.location = '/desktop'; | |
}); | |
}); |
<meta id="viewport" name='viewport'> | |
<script> | |
(function(doc) { | |
var viewport = document.getElementById('viewport'); | |
if ( navigator.userAgent.match(/iPhone|iPod/i) || screen.width <= 640) { | |
doc.getElementById("viewport").setAttribute("content", "initial-scale=0.3, maximum-scale=1.0, width=device-width"); | |
} else if ( navigator.userAgent.match(/Android|webOS|iPad|BlackBerry|IEMobile|Opera Mini/i) || screen.width > 640 ) { | |
doc.getElementById("viewport").setAttribute("content", "initial-scale=1.0, maximum-scale=1.0, width=device-width"); | |
} | |
}(document)); |