Replace image src location using CSS

You can use a background image .application-title img { width:200px; height:200px; box-sizing:border-box; padding-left: 200px; /*width of the image*/ background: url(http://lorempixel.com/200/200/city/2) left top no-repeat; } <div class=”application-title”> <img src=”http://lorempixel.com/200/200/city/1/”> </div><br /> Original Image: <br /> <img src=”http://lorempixel.com/200/200/city/1/”>

dragover vs dragenter events of HTML5 drag & drop

The dragenter event happens at the moment you drag something in to the target element, and then it stops. The dragover event happens during the time you are dragging something until you drop it. Look here: $(‘.dropzone’).on(“dragover”, function (event) { console.log(‘dragover’); }); $(‘.dropzone’).on(“dragenter”, function (event) { console.log(‘dragenter’); }); Now see the console: As you can … Read more

Remove whitespace from SVG

Someone created a jsfiddle with a script that trims the svg for you which you can find here. Here’s the script if you need to use it in your project: var svg = document.getElementsByTagName(“svg”)[0]; var bbox = svg.getBBox(); var viewBox = [bbox.x, bbox.y, bbox.width, bbox.height].join(” “); svg.setAttribute(“viewBox”, viewBox); prompt(“Copy to clipboard: Ctrl+C, Enter”, svg.outerHTML); Additionally, … Read more