Web & Software Developer

Posts Tagged “jQuery”

Toggle Show/Hide with jQuery

This is for when you need to toggle showing and hiding more than one element on a page. For example, a page full of headings in which you click a heading to show a list underneath it, then click again to hide the list. This uses jQuery. (See this instead for a pure JavaScript example.) … Read more →

Equal Heights For WordPress Image Gallery Captions

This gives your WordPress image captions equal heights on a gallery page. The text captions will take the height of the tallest caption on the page. This applies to the “gallery-caption” element, not to the entire “gallery-item” element. This is useful if you added a background color for your “gallery-caption” or “wp-caption-text“. Captions with a … Read more →

Send Localized PHP variables to jQuery

This was my way of localizing jQuery strings: 1. Set a variable for the localized string in PHP 2. Set that as a jQuery var, and send/hack it up to the head inside my wp_enqueue_scripts function right above the line to enqueue the .js script that needs to use the variable. My method, as is … Read more →

Add CSS Class To nth-child Element With JQuery

This example script is for use with a 3-column layout. It adds the class=”first” to the first column element, and the class=”last” to the 3rd column element. Simple Variation For Wrapped Rows If you have a grid layout that has each row wrapped with a wrapper element, then you only need to add a CSS … Read more →