CodeHQ

Posts Tagged ‘javascript’

|

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 »

Vanilla List: The Vanilla Javascript Repository

Friday, June 3rd, 2016

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

Execute function on defined vertical scroll position

Tuesday, February 17th, 2015

$(window).scroll(function() {
    var y_scroll_pos = window.pageYOffset;
    var scroll_pos_test = 150;             
	// set to whatever you want it to be

    if(y_scroll_pos > scroll_pos_test) {
	   $("body").css("background-color","#000");
    }
	else
	{
		$("body").css("background-color","#FFF");
	}
});

Tags: , ,
Posted in jQuery | No Comments »