/* * Name : main.js * Version : 1.0 * Author : onepixel studio * Date : 2020-05-15 --------------------------------------------------- Table of contents --------------------------------------------------- 01. init 02. hero 03. contact form --------------------------------------------------- */ 'use strict'; $(function() { // init hero_init(); contact_form_init(); // hero function hero_init() { if ( $('.hero-swiper').length ) { var $interval = $('.hero-swiper').data('interval') ? $('.hero-swiper').data('interval') : 4000; var $hero = new Swiper('.hero-swiper', { loop: true, navigation: { prevEl: '.hero-swiper .navigation-arrow .prev', nextEl: '.hero-swiper .navigation-arrow .next', }, pagination: { el: '.hero-swiper .swiper-pagination', clickable: true, }, autoplay: { delay: $interval, disableOnInteraction: false, }, }); } $('.hero-swiper .scroll-indicator').on('click', function() { $('html, body').stop().animate({ scrollTop: $('.hero-swiper').next('section').offset().top }, 400); }); } // contact form function contact_form_init() { if ( $('.main .contact-form .formmail_border').length ) { var $el = $('.main .contact-form .formmail_border'), $context = $('.main .contact-form .formmail_textarea_style'); $el.each(function() { $(this).attr('placeholder', $.trim($(this).closest('tr').find('.formmail_title_bgcolor').text())); }); if ( $context.length ) $context.attr('placeholder', $.trim($context.closest('tr').find('.formmail_title_bgcolor').text())); } } });