Blog

Posts tagged with "JS"

A super simple jquery lightbox

This snippet will create a very lightweight simple light box effect for you to use on images.

Add this code inside your document ready function after loading jQuery.

$('.lb').click(function(e){     e.preventDefault();     ...

see full post
tags:

How to verify an email address with jQuery

This snippet will verify an email address is correct using a regular expression.

Add this code inside your document ready function.

function isValidEmailAddress(emailAddress) {     var pattern = /^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*(([ \t]*\r\n)?[ ...

see full post
tags:

How to stop scrolling when cursor is over an element with jQuery

Use the snippet below to remove the ability to page scroll with the mouse when the cursor is over an element with jQuery.

$.fn.isolatedScroll = function() {     this.bind('mousewheel DOMMouseScroll', function ...

see full post
tags:

How to add unit separator commas to numbers with jQuery

To format a number with jQuery to seperate its units with commas use the snippet below:

function ReplaceNumberWithCommas(yourNumber) {     var n= yourNumber.toString().split(".");     n[0] = n[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");     ...

see full post
tags:

welcome to the eudemonics blog ...

you can find posts about the things i've been working on, useful code snippets and articles relating to my interests.

comments can be left at the bottom of each post, if you wish to contribute to an article please get in touch.

Blog Categories

Blog Tags