A fresh mix of code snippets and tutorials

Category Archive: JavaScript

Posts about JavaScript

Page 3 of 5

jQuery Preview Selected Images

This jQuery script displays a live preview of the currently selected images, as selected from a file input field.

jQuery Reload Current Page on Click

jQuery makes it easy to do all kinds of cool stuff. For example, here is a code snippet to reload the current page with a click.

Remove Linked Image Borders in IE

Internet Explorer has a nasty habit of displaying honking blue borders on linked images. This post shows a quick way to disable them using a slice of jQuery.

Auto-Height for Ajax-Loaded Content

Here is a jQuery function for automatically setting the height of Ajax-loaded content.

Detect Chrome, IE, Firefox, Opera, and Safari

How to detect each of the major browsers (Chrome, IE, Firefox, Opera, Safari) client-side via JavaScript.

Resize Google Search iframe

I’ve integrated Google Custom Search at DigWP.com and Perishable Press. In doing so, I found it necessary to resize the google-search iframe in order to fit with the responsive layout.

Superbox replace rel with data-rel

At WP-Tao.com, I use jQuery Superbox to display lightbox-style popup images and screenshots. Here is a quick mod used to replace rel attributes with data-rel.

Lazy Load Tricks

I use Lazy Load for the sweet animated effects at Plugin Planet. Here are some code snippets for future reference.

WordPress enqueue user-agent stylesheets

WordPress makes it clean and easy to enqueue custom stylesheets via the functions.php file. Here’s how to do it for user-agent stylesheets.

Fade in page content with jQuery

Here are two simple techniques to fade in page content with jQuery. The fade-in effect isn’t for everyone, but it’s a nice tool to have in the box.

PHP Compress CSS & JavaScript

Quick snippets for compressing CSS and JavaScript with PHP’s ob_gzhandler, which will gzip or deflate content depending on browser support.

jQuery align elements with the grid

When working on a CSS grid, here’s one way of aligning variable-height elements, such as blocks of pre-formatted code, advertisements, and so on.