Skip to content

Instantly share code, notes, and snippets.

View albburtsev's full-sized avatar
💭
🤔

Alexander Burtsev albburtsev

💭
🤔
View GitHub Profile
@albburtsev
albburtsev / jquery.viewport-event.js
Created February 3, 2011 12:32
Viewport Event jQuery Plugin
/*
Example:
$('div')
.viewport()
.one('viewport', function() {
$(this).addClass('view');
});
*/
(function($) {
$.fn.viewport = function() {
@albburtsev
albburtsev / isTouchDevice.js
Created January 25, 2011 11:08
Simple touch device detection
// See from http://chris-barr.com/files/touchScroll.htm
var isTouchDevice = function(){
try {
document.createEvent("TouchEvent");
return true;
} catch(e) {
return false;
}
}
@albburtsev
albburtsev / jquery.placeholder.js
Created January 25, 2011 11:04
Custom placeholder for text input
$.placeHolder = function(input, text) {
var _input = $(input),
_class = 'placeholder';
_value = _input.val();
_input
.focus(function() {
_value = $(this).val();
$(this)
.removeClass(_class)
.val(_value == text ? '' : _value)