This is a very simple lightweight plugin to allow you to move the caret (or cursor) position in an <input /> or <textarea> element.
By exposing three jQuery.fn methods you can easily move a a caret to any position you like:
$(function() { | |
var resizeEnd; | |
$(window).on('resize', function() { | |
clearTimeout(resizeEnd); | |
resizeEnd = setTimeout(function() { | |
$(window).trigger('resizeEnd'); |
<?php | |
function fillMyArr($from, $to) | |
{ | |
for ($i = $from; $i <= $to; $i++) | |
$arr[$i] = $i; | |
return $arr; | |
<div class="container"> | |
<div class="a">1</div> | |
<div class="b">2</div> | |
<div class="c"> | |
<div>3.1</div> | |
<div>3.1</div> | |
<div>3.1</div> |
<div class="container"> | |
<div class="a">1</div> | |
<div class="b">2</div> | |
<div class="c"> | |
<div>3.1</div> | |
<div>3.1</div> | |
<div>3.1</div> |
<?php | |
/** | |
* Sanitize a multidimensional array | |
* | |
* @uses htmlspecialchars | |
* | |
* @param (array) | |
* @return (array) the sanitized array | |
*/ |
I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.
If you want to roll up all of these into a single jQuery plugin check out Sharrre
Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.
(function($) { | |
$.extend($.expr[':'], { | |
group: jQuery.expr.createPseudo(function(num) { | |
return function(elem) { | |
if (isNaN(num)) { | |
return false; | |
} | |
return ($(elem).index() - 1) % (num * 2) < num; | |
}; |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>TEST</title> | |
<script src="jquery.js"></script> | |
<style> | |
var log = { | |
target: $("#message"), | |
pridej: function(text){ | |
this.target.append(text + "<br />"); | |
}, | |
clear: function() | |
{ |