Untitled
unknown
plain_text
a year ago
2.7 kB
7
Indexable
function live(selector, event, callback, context) {
function addEvent(el, type, handler) {
if (el.attachEvent) el.attachEvent('on' + type, handler);
else el.addEventListener(type, handler);
}
this.Element &&
(function (ElementPrototype) {
ElementPrototype.matches =
ElementPrototype.matches ||
ElementPrototype.matchesSelector ||
ElementPrototype.webkitMatchesSelector ||
ElementPrototype.msMatchesSelector ||
function (selector) {
var node = this,
nodes = (node.parentNode || node.document).querySelectorAll(selector),
i = -1;
while (nodes[++i] && nodes[i] != node);
return !!nodes[i];
};
})(Element.prototype);
function live(selector, event, callback, context) {
addEvent(context || document, event, function (e) {
var found,
el = e.target || e.srcElement;
while (el && el.matches && el !== context && !(found = el.matches(selector))) el = el.parentElement;
if (found) callback.call(el, e);
});
}
live(selector, event, callback, context);
};
live('.eg-get-btn', 'click', function() {
var heroSection = document.querySelector('.herobanner .c-hero');
heroSection.scrollIntoView({ behavior: 'smooth' });
document.body.classList.add('eg-heroBgLayout');
})
live('.eg-heroBg', 'click', function() {
document.body.classList.remove('eg-heroBgLayout');
})
/* Variation Init */
function heroSection() {
var heroTitle = document.querySelector('.c-vue-product-finder-content__title h3');
if(heroTitle) {
heroTitle.innerText = 'Professional services insurance';
}
var heroPara = document.querySelector('.c-vue-product-finder-content__text p');
if(heroPara) {
heroPara.innerText = 'While you look after your clients, let Marsh arrange the best suited insurance cover to help protect your business.';
}
var search = document.querySelector('.multiselect__placeholder p');
if(search) {
search.innerText = 'Choose your occupation';
}
var newDiv = document.createElement('div');
newDiv.classList.add('eg-heroBg');
var layout = document.querySelector('.responsivegrid > .cmp-container:nth-child(2)');
if (layout) {
layout.insertAdjacentElement('afterbegin', newDiv);
}
}Editor is loading...
Leave a Comment