Categories
Resources Tips Tutorials

Making your videos responsive to screen resolution with JQuery

This is a nice piece of code I found in Stack Overflow, but I love the solution posted by Darwin in October 12 2012 and I tweaked to fit my needs and here is my code: function adjustVideoRatioToParent(arr){ var element = (arr.e === undefined)? jQuery(‘iframe[src*=”youtube”]’) : jQuery(arr.e); //set element or elements var eParent = element.parent(); […]

Categories
Tutorials

Getting the ID of an element with plain JavaScript

I was searching for this for very long and didn’t really found something useful unless using a¬†JavaScript¬†framework, but for those who want to learn to code from scratch this is the answer. First you have to get the element that triggers an event. example: HTML <div id=”hello” onclick=”getId();”></div> <!– in Firefox is necessary to include […]