Type: js
Open all external links in new tab (copy)
app
// select the item element const item = document.querySelector(‘.item’); // attach the dragstart event handler item.addEventListener(‘dragstart’, dragStart); // handle the dragstart function dragStart(e) { e.dataTransfer.setData(‘text/plain’, e.target.id); setTimeout(() => { e.target.classList.add(‘hide’); }, 0); } const boxes = document.querySelectorAll(‘.box’); boxes.forEach(box => {…Continue reading
Lodgify Book Now Button
Open all external links in new tab
Runs After A Successful OptinMonster Conversion (om.Optin.success)
document.addEventListener(‘om.Optin.success’, function(event) { // This event is passed the Campaign object console.log(event.detail.Campaign); // This event is passed the Optin object console.log(event.detail.Optin); // This event is passed the success response console.log(event.detail.response); } );Continue reading
Weather API
Count Up
Passive Listener
addEventListener(document, “touchstart”, function(e) { console.log(e.defaultPrevented); // will be false e.preventDefault(); // does nothing since the listener is passive console.log(e.defaultPrevented); // still false }, Modernizr.passiveeventlisteners ? {passive: true} : false);Continue reading
Consult Conversion Page
gtag(‘event’, ‘conversion’, {‘send_to’: ‘AW-11073936294/9dSWCKudhIkYEKa3u6Ap’});Continue reading