CodeHQ

Posts Tagged ‘jQuery’

|

Find elements on page by their CSS Properties

Tuesday, February 12th, 2019

Drop this in to your console in dev tools and all elements with position: absolute will render with a border.

var absElements = [];
$("*").css("position", function(i, pos){
   if(pos==="absolute") absElements.push(this);
});

$(absElements).css({border:"5px solid red"});

Tags: , , , , , , ,
Posted in CSS, jQuery | No Comments »

Remove spaces in tel href links

Wednesday, August 29th, 2018

/* Remove all spaces in tel: href links so click to call works */
$('a[href^="tel:"]').attr('href', function(_,v){
    return v.replace(/\(0\)|\s+/g,'')
});

Tags: , , , , , ,
Posted in jQuery | No Comments »

jQuery in the footer

Thursday, December 1st, 2016

Add this to your functions.php

function my_init()   
{  
    if (!is_admin())   
    {  
        wp_deregister_script('jquery');  
  
        // Load a copy of jQuery from the Google API CDN  
        // The last parameter set to TRUE states that it should be loaded  
        // in the footer.  
        wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js', FALSE, '1.11.0', TRUE);  
  
        wp_enqueue_script('jquery');  
    }  
}  
add_action('init', 'my_init');  

Tags: , , , , ,
Posted in jQuery, PHP, WordPress | No Comments »

Vanilla List: The Vanilla Javascript Repository

Friday, June 3rd, 2016

Tags: , , , ,
Posted in jQuery | 1 Comment »

unorphan.js | Prevents text orphans | jQuery

Friday, December 11th, 2015

A jQuery method to remove text orphans from any element you declare. Light-weight and easy to use!

$(function() {
    unorphan($('p, h1, h2, h3, h4'))
});

Tags: , ,
Posted in jQuery | No Comments »

Equal Heights of columns with jQuery

Friday, June 5th, 2015

Tags: , , , ,
Posted in jQuery | No Comments »

Priority navigation

Thursday, May 7th, 2015

Tags: , , , ,
Posted in CSS, HTML, jQuery | No Comments »