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();
...
Friday, March 3rd, 2017
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();
...
Tuesday, January 3rd, 2017
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)?[ ...
Wednesday, December 14th, 2016
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 ...
Monday, November 28th, 2016
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, ",");
...
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.