{
if (document.documentElement.clientWidth < 768) {
if (document.getElementsByClassName('sl-banner-mobile-wrapper').length > 0){
let bannerMobile = document.getElementsByClassName('sl-banner-mobile-wrapper')[0];
let mobileHasButton = bannerMobile.getElementsByClassName('translate-x-0').length > 0;
if (mobileHasButton) {
$el.style.marginBottom = '';
} else {
$el.style.marginBottom = '30px';
}
}
else {
$el.style.marginBottom = '30px';
}
const allBannerSlides = $el.getElementsByClassName('sl-banner-full-item');
const bannerSlidesHeights = Array.from(allBannerSlides).map((slide) => {
const bannerSlideImageHeight = slide.querySelector('.sl-banner-image')?.clientHeight || 0;
const bannerSlideContentsHeight = Array.from(slide
.querySelector('.sl-banner-content-wrapper')
.children).reduce((totalHeight, element) => totalHeight + element.clientHeight, 0);
return bannerSlideImageHeight + bannerSlideContentsHeight + 94 + 40;
});
const maxHeight = Math.max(...bannerSlidesHeights);
if (maxHeight > 550) $el.style.height = maxHeight + 'px';
else $el.style.height = '550px';
} else {
$el.style.marginBottom = '';
$el.style.height = null;
}
}" @add-timeline-arr.window="let timeline = gsap.timeline({repeat: -1, yoyo: true});
let classes = ".item-" + $event.detail.page;
timeline.to(classes, {duration: 2, x: 200, y:200, ease:"none"});
timeline.pause();
$data.timeline_arr[$event.detail.page] = timeline;
if ($event.detail.page == 1) {
$data.timeline_arr[$event.detail.page].play();
}" @play-timeline-animation.window="$data.timeline_arr[$event.detail.page].play();" @pause-timeline-animation.window="$data.timeline_arr[$event.detail.page].pause();" x-on:resize.window.debounce="$dispatch('check-banner')" x-init="(() => {
let typingInterval = setInterval(startTyping, $data.typeSpeed);
//- clear no typing text
if (document.getElementsByClassName('sl-banner-typewriter').length < 1) {
clearInterval(typingInterval);
}
function startTyping() {
try {
let current = $data.textArray[ $data.textIndex ];
if ($data.charIndex > current.length) {
$data.direction = 'backward';
clearInterval(typingInterval);
setTimeout( function() {
typingInterval = setInterval(startTyping, $data.typeSpeed);
}, $data.pauseEnd );
}
$data.text = current.substring(0, $data.charIndex);
if ($data.direction == 'forward') {
$data.charIndex += 1;
} else {
if($data.charIndex == 0){
$data.direction = 'forward';
clearInterval(typingInterval);
setTimeout(function(){
$data.textIndex += 1;
if($data.textIndex >= $data.textArray.length){
$data.textIndex = 0;
}
typingInterval = setInterval(startTyping, $data.typeSpeed);
}, $data.pauseStart);
}
$data.charIndex -= 1;
}
} catch(e) {}
}
rorateBannerInterval = setInterval(() => {
$data.pageNumber = $data.pageNumber < bannerCount ? $data.pageNumber += 1 : $data.pageNumber = 1;
$dispatch('swiping-banner', { current_page: $data.pageNumber});
}, 5000);
$watch('onSwiping', value => {
console.log('change swiping', value);
if(value == true){
window.clearInterval(rorateBannerInterval);
}
else {
rorateBannerInterval = setInterval(() => {
$data.pageNumber = $data.pageNumber < bannerCount ? $data.pageNumber += 1 : $data.pageNumber = 1;
$dispatch('swiping-banner', { current_page: $data.pageNumber});
}, 5000);
}
});
const bannerCount = document.getElementsByClassName('sl-banner-full-item').length;
const hammer = new Hammer($el);
let lastAngle = 0;
hammer.on('pan', function(e) {
$data.swipeDeltaX = e.deltaX;
if(e.isFinal != true){
$data.onSwiping = true;
lastAngle = e.angle;
}
if (e.isFinal == true) {
$data.onSwiping = false;
$data.swipeDeltaX = 0;
if(lastAngle == 0) lastAngle = e.angle;
if (e.isFinal == true && (lastAngle < -115 || lastAngle > 115)) {
if ($data.pageNumber < bannerCount) {
$data.pageNumber += 1;
$dispatch('swiping-banner', { current_page: $data.pageNumber});
}
setTimeout(()=> { $dispatch('check-banner'); }, 300);
} else if (e.isFinal == true && (lastAngle < 45 && lastAngle > -45)) {
if ($data.pageNumber > 1) {
$data.pageNumber -= 1;
$dispatch('swiping-banner', { current_page: $data.pageNumber});
}
setTimeout(()=> { $dispatch('check-banner'); }, 300);
}
lastAngle = 0;
}
});
setTimeout(()=> { $dispatch('check-banner'); }, 300);
$nextTick(() => {
setTimeout(() => {
$data.bannerLoaded = true;
}, 1000);
bannerLoaded = true;
});
})()">
Ready to buy online?
Customise your term life coverage in just a few clicks.
Prefer to speak to someone?
Leave your details and our financial adviser representative will be in touch shortly for a no-obligations chat.
Sorry, there seems to be a problem with this page. Please refresh and try again in a few minutes.
Thank you for your submission.
Please enable javascript on your internet browser in order to use this form