Sin descripción

script.js 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. (function($) {
  2. "use strict";
  3. //1.Hide Loading Box (Preloader)
  4. function handlePreloader() {
  5. if($('.preloader').length){
  6. $('.preloader').delay(200).fadeOut(500);
  7. }
  8. }
  9. //2.Update header style + Scroll to Top
  10. function headerStyle() {
  11. if($('.main-header').length){
  12. var windowpos = $(window).scrollTop();
  13. if (windowpos >= 250) {
  14. $('.main-header').addClass('fixed-header');
  15. $('.scroll-to-top').fadeIn(300);
  16. } else {
  17. $('.main-header').removeClass('fixed-header');
  18. $('.scroll-to-top').fadeOut(300);
  19. }
  20. }
  21. }
  22. headerStyle();
  23. //3.Submenu Dropdown Toggle
  24. if($('.main-header li.dropdown ul').length){
  25. $('.main-header li.dropdown').append('<div class="dropdown-btn"><span class="fa fa-angle-down"></span></div>');
  26. //Dropdown Button
  27. $('.main-header li.dropdown .dropdown-btn').on('click', function() {
  28. $(this).prev('ul').slideToggle(500);
  29. });
  30. //Disable dropdown parent link
  31. $('.navigation li.dropdown > a').on('click', function(e) {
  32. e.preventDefault();
  33. });
  34. }
  35. //4.Main BX-Slider
  36. if($('.events-slide').length){
  37. $('.events-slide').bxSlider({
  38. auto:true,
  39. mode:'vertical',
  40. nextSelector: '.events-section #slider-next',
  41. prevSelector: '.events-section #slider-prev',
  42. nextText: '<i class="fa fa-angle-right"></i>',
  43. prevText: '<i class="fa fa-angle-left"></i>',
  44. maxSlides: 3,
  45. minSlides: 3,
  46. moveSlides: 1,
  47. pause: 5000,
  48. speed: 700,
  49. pagerCustom: '.events-section .slider-pager .thumb-box'
  50. });
  51. }
  52. //5.Search Toggle Btn
  53. if($('.toggle-search').length){
  54. $('.toggle-search').on('click', function() {
  55. $('.header-search').slideToggle(300);
  56. });
  57. }
  58. //6.Revolution Slider Style One
  59. if($('.main-slider .tp-banner').length){
  60. jQuery('.main-slider .tp-banner').show().revolution({
  61. dottedOverlay:'none',
  62. delay:10000,
  63. startwidth:1200,
  64. startheight:700,
  65. hideThumbs:600,
  66. thumbWidth:80,
  67. thumbHeight:50,
  68. thumbAmount:5,
  69. navigationType:"bullet",
  70. navigationArrows:"0",
  71. navigationStyle:"preview3",
  72. touchenabled:"on",
  73. onHoverStop:"off",
  74. swipe_velocity: 0.7,
  75. swipe_min_touches: 1,
  76. swipe_max_touches: 1,
  77. drag_block_vertical: false,
  78. parallax:"mouse",
  79. parallaxBgFreeze:"on",
  80. parallaxLevels:[7,4,3,2,5,4,3,2,1,0],
  81. keyboardNavigation:"off",
  82. navigationHAlign:"center",
  83. navigationVAlign:"bottom",
  84. navigationHOffset:0,
  85. navigationVOffset:40,
  86. soloArrowLeftHalign:"left",
  87. soloArrowLeftValign:"center",
  88. soloArrowLeftHOffset:20,
  89. soloArrowLeftVOffset:20,
  90. soloArrowRightHalign:"right",
  91. soloArrowRightValign:"center",
  92. soloArrowRightHOffset:20,
  93. soloArrowRightVOffset:20,
  94. shadow:0,
  95. fullWidth:"on",
  96. fullScreen:"off",
  97. spinner:"spinner4",
  98. stopLoop:"off",
  99. stopAfterLoops:-1,
  100. stopAtSlide:-1,
  101. shuffle:"off",
  102. autoHeight:"off",
  103. forceFullWidth:"on",
  104. hideThumbsOnMobile:"on",
  105. hideNavDelayOnMobile:1500,
  106. hideBulletsOnMobile:"on",
  107. hideArrowsOnMobile:"on",
  108. hideThumbsUnderResolution:0,
  109. hideSliderAtLimit:0,
  110. hideCaptionAtLimit:0,
  111. hideAllCaptionAtLilmit:0,
  112. startWithSlide:0,
  113. videoJsPath:"",
  114. fullScreenOffsetContainer: ""
  115. });
  116. }
  117. //7.Mixitup Gallery
  118. if($('.mixitup-gallery').length){
  119. $('.mixitup-gallery').mixItUp({});
  120. }
  121. //8.Sortable Masonary with Filters
  122. function enableMasonry() {
  123. if($('.sortable-masonry').length){
  124. var winDow = $(window);
  125. // Needed variables
  126. var $container=$('.sortable-masonry .items-container');
  127. var $filter=$('.filter-btns');
  128. $container.isotope({
  129. filter:'*',
  130. masonry: {
  131. columnWidth : 0
  132. },
  133. animationOptions:{
  134. duration:500,
  135. easing:'linear'
  136. }
  137. });
  138. // Isotope Filter
  139. $filter.find('li').on('click', function(){
  140. var selector = $(this).attr('data-filter');
  141. try {
  142. $container.isotope({
  143. filter : selector,
  144. animationOptions: {
  145. duration: 500,
  146. easing : 'linear',
  147. queue : false
  148. }
  149. });
  150. } catch(err) {
  151. }
  152. return false;
  153. });
  154. winDow.bind('resize', function(){
  155. var selector = $filter.find('li.active').attr('data-filter');
  156. $container.isotope({
  157. filter : selector,
  158. animationOptions: {
  159. duration: 500,
  160. easing : 'linear',
  161. queue : false
  162. }
  163. });
  164. });
  165. var filterItemA = $('.filter-btns li');
  166. filterItemA.on('click', function(){
  167. var $this = $(this);
  168. if ( !$this.hasClass('active')) {
  169. filterItemA.removeClass('active');
  170. $this.addClass('active');
  171. }
  172. });
  173. }
  174. }
  175. enableMasonry();
  176. //9.Gallery masonary style
  177. if ($('.item-container').length) {
  178. $('.item-container').isotope({
  179. layoutMode:'masonry'
  180. });
  181. }
  182. //10.PieChart RoundCircle
  183. function expertizeRoundCircle () {
  184. var rounderContainer = $('.piechart');
  185. if (rounderContainer.length) {
  186. rounderContainer.each(function () {
  187. var Self = $(this);
  188. var value = Self.data('value');
  189. var size = Self.parent().width();
  190. var color = Self.data('fg-color');
  191. Self.find('span').each(function () {
  192. var expertCount = $(this);
  193. expertCount.appear(function () {
  194. expertCount.countTo({
  195. from: 1,
  196. to: value*100,
  197. speed: 3000
  198. });
  199. });
  200. });
  201. Self.appear(function () {
  202. Self.circleProgress({
  203. value: value,
  204. size: 142,
  205. thickness: 10,
  206. emptyFill: '#24c4f4',
  207. animation: {
  208. duration: 3000
  209. },
  210. fill: {
  211. color: color
  212. }
  213. });
  214. });
  215. });
  216. };
  217. }
  218. //11.progressBarConfig
  219. function progressBarConfig () {
  220. var progressBar = $('.progress');
  221. if(progressBar.length) {
  222. progressBar.each(function () {
  223. var Self = $(this);
  224. Self.appear(function () {
  225. var progressValue = Self.data('value');
  226. Self.find('.progress-bar').animate({
  227. width:progressValue+'%'
  228. }, 100);
  229. Self.find('span.value').countTo({
  230. from: 0,
  231. to: progressValue,
  232. speed: 100
  233. });
  234. });
  235. })
  236. }
  237. }
  238. //12.Fact Counter
  239. function CounterNumberChanger () {
  240. var timer = $('.timer');
  241. if(timer.length) {
  242. timer.appear(function () {
  243. timer.countTo();
  244. })
  245. }
  246. }
  247. //13.Fact Counter
  248. function factCounter() {
  249. if($('.fact-counter').length){
  250. $('.fact-counter .counter-column.animated').each(function() {
  251. var $t = $(this),
  252. n = $t.find(".count-text").attr("data-stop"),
  253. r = parseInt($t.find(".count-text").attr("data-speed"), 10);
  254. if (!$t.hasClass("counted")) {
  255. $t.addClass("counted");
  256. $({
  257. countNum: $t.find(".count-text").text()
  258. }).animate({
  259. countNum: n
  260. }, {
  261. duration: r,
  262. easing: "linear",
  263. step: function() {
  264. $t.find(".count-text").text(Math.floor(this.countNum));
  265. },
  266. complete: function() {
  267. $t.find(".count-text").text(this.countNum);
  268. }
  269. });
  270. }
  271. });
  272. }
  273. }
  274. //14.Accordion Box
  275. if ($('.accordion-box').length) {
  276. $('.accordion-box .acc-btn').on('click', function() {
  277. if ($(this).hasClass('active') !== true) {
  278. $('.accordion-box .acc-btn').removeClass('active');
  279. }
  280. if ($(this).next('.acc-content').is(':visible')) {
  281. $(this).removeClass('active');
  282. $(this).next('.acc-content').slideUp(500);
  283. } else {
  284. $(this).addClass('active');
  285. $('.accordion-box .acc-content').slideUp(500);
  286. $(this).next('.acc-content').slideDown(500);
  287. }
  288. });
  289. }
  290. //15.Sponsors Slider
  291. if ($('.sponsors-slider').length) {
  292. $('.sponsors-slider').owlCarousel({
  293. loop:true,
  294. margin:10,
  295. nav:true,
  296. smartSpeed: 400,
  297. autoplay: 4000,
  298. navText: [],
  299. responsive:{
  300. 300:{
  301. items:1
  302. },
  303. 400:{
  304. items:2
  305. },
  306. 800:{
  307. items:3
  308. },
  309. 1200:{
  310. items:6
  311. }
  312. }
  313. });
  314. }
  315. //16.Four Column Carousel Slider
  316. if ($('.four-column-carousel').length) {
  317. $('.four-column-carousel').owlCarousel({
  318. loop:true,
  319. margin:30,
  320. nav:true,
  321. smartSpeed: 500,
  322. autoplay: 4000,
  323. navText: [ '<span class="fa fa-angle-left"></span>', '<span class="fa fa-angle-right"></span>' ],
  324. responsive:{
  325. 0:{
  326. items:1
  327. },
  328. 600:{
  329. items:2
  330. },
  331. 800:{
  332. items:3
  333. },
  334. 1070:{
  335. items:4
  336. }
  337. }
  338. });
  339. }
  340. //17.Three Column Carousel Slider
  341. if ($('.three-column-carousel').length) {
  342. $('.three-column-carousel').owlCarousel({
  343. loop:true,
  344. margin:30,
  345. nav:true,
  346. smartSpeed: 500,
  347. autoplay: 4000,
  348. navText: [ '<span class="fa fa-angle-left"></span>', '<span class="fa fa-angle-right"></span>' ],
  349. responsive:{
  350. 0:{
  351. items:1
  352. },
  353. 480:{
  354. items:1
  355. },
  356. 600:{
  357. items:2
  358. },
  359. 800:{
  360. items:2
  361. },
  362. 1024:{
  363. items:3
  364. }
  365. }
  366. });
  367. }
  368. //18.Two Column Carousel Slider
  369. if ($('.two-column-carousel').length) {
  370. $('.two-column-carousel').owlCarousel({
  371. loop:true,
  372. margin:30,
  373. nav:true,
  374. smartSpeed: 500,
  375. autoplay: 4000,
  376. navText: [ '<span class="fa fa-angle-left"></span>', '<span class="fa fa-angle-right"></span>' ],
  377. responsive:{
  378. 0:{
  379. items:1
  380. },
  381. 1200:{
  382. items:2
  383. }
  384. }
  385. });
  386. }
  387. //19.Single Item Slider
  388. if ($('.single-item-carousel').length) {
  389. $('.single-item-carousel').owlCarousel({
  390. loop:true,
  391. margin:0,
  392. nav:true,
  393. smartSpeed: 700,
  394. autoplay: 4000,
  395. navText: [ '<span class="fa fa-angle-left"></span>', '<span class="fa fa-angle-right"></span>' ],
  396. responsive:{
  397. 0:{
  398. items:1
  399. },
  400. 600:{
  401. items:1
  402. },
  403. 1200:{
  404. items:1
  405. }
  406. }
  407. });
  408. }
  409. //20.Jquery Tabs Box
  410. if($('.tabs-box').length){
  411. //Tabs
  412. $('.tabs-box .tab-buttons .tab-btn').on('click', function(e) {
  413. e.preventDefault();
  414. var target = $($(this).attr('href'));
  415. target.parents('.tabs-box').children('.tab-buttons').children('.tab-btn').removeClass('active-btn');
  416. $(this).addClass('active-btn');
  417. target.parents('.tabs-box').children('.tab-content').children('.tab').fadeOut(0);
  418. target.parents('.tabs-box').children('.tab-content').children('.tab').removeClass('active-tab');
  419. $(target).fadeIn(300);
  420. $(target).addClass('active-tab');
  421. });
  422. }
  423. //21.Tabbed Floor Plans Function
  424. if($('.tabbed-floor-plans .floor-btn').length){
  425. //Floor Details Hide Show
  426. $('.tabbed-floor-plans .floor-btn').on('click', function(e) {
  427. e.preventDefault();
  428. var target = $($(this).attr('href'));
  429. $('.tabbed-floor-plans .floor-btn').removeClass('active');
  430. $(this).addClass('active');
  431. $('.tabbed-floor-plans .floor-details').removeClass('collapsed');
  432. $('.tabbed-floor-plans .floor-details ').fadeOut(0);
  433. $(target).fadeIn(300);
  434. });
  435. }
  436. //22.LightBox / Fancybox
  437. if($('.fancybox').length) {
  438. $('.fancybox').fancybox({
  439. openEffect : 'elastic',
  440. closeEffect : 'elastic',
  441. helpers : {
  442. media : {}
  443. }
  444. });
  445. }
  446. //23.videoFancybox
  447. function videoFancybox () {
  448. if ($('.video-fancybox').length) {
  449. $('.video-fancybox').on('click', function () {
  450. $(this).fancybox({
  451. 'padding' : 0,
  452. 'autoScale' : false,
  453. 'transitionIn' : 'none',
  454. 'transitionOut' : 'none',
  455. 'title' : this.title,
  456. 'width' : 640,
  457. 'height' : 385,
  458. 'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
  459. 'type' : 'swf',
  460. 'swf' : { 'wmode' : 'transparent', 'allowfullscreen' : 'true' }
  461. });
  462. return false;
  463. })
  464. };
  465. }
  466. //24.Contact Form Validation
  467. if($('#contact_form').length){
  468. $("#contact_form").validate({
  469. submitHandler: function(form) {
  470. var form_btn = $(form).find('button[type="submit"]');
  471. var form_result_div = '#form-result';
  472. $(form_result_div).remove();
  473. form_btn.before('<div id="form-result" class="alert alert-success" role="alert" style="display: none;"></div>');
  474. var form_btn_old_msg = form_btn.html();
  475. form_btn.html(form_btn.prop('disabled', true).data("loading-text"));
  476. $(form).ajaxSubmit({
  477. dataType: 'json',
  478. success: function(data) {
  479. if( data.status == 'true' ) {
  480. $(form).find('.form-control').val('');
  481. }
  482. form_btn.prop('disabled', false).html(form_btn_old_msg);
  483. $(form_result_div).html(data.message).fadeIn('slow');
  484. setTimeout(function(){ $(form_result_div).fadeOut('slow') }, 6000);
  485. }
  486. });
  487. }
  488. });
  489. }
  490. //25.Gallery Popup Hide / Show
  491. if($('.has-gallery-popup').length){
  492. //Show Gallery Popup
  493. $('.has-gallery-popup').on('click', function(e) {
  494. e.preventDefault();
  495. var target = $($(this).attr('href'));
  496. $('body').addClass('popup-visible');
  497. $(target).addClass('now-visible');
  498. });
  499. //Show Gallery Popup
  500. $('.gallery-box .btn-close,.gallery-box .bg-fade-layer').on('click', function() {
  501. $('.gallery-box').removeClass('now-visible');
  502. $('body').removeClass('popup-visible');
  503. });
  504. }
  505. //26.Gallery Popup Slider / Vertical Gallery Slider
  506. if($('.vertical-slider').length) {
  507. var slider = new MasterSlider();
  508. slider.setup('masterslider' , {
  509. width:850,
  510. height:470,
  511. space:10,
  512. view:'basic',
  513. dir:'v'
  514. });
  515. slider.control('arrows');
  516. slider.control('scrollbar' , {dir:'v'});
  517. slider.control('circletimer' , {color:"#FFFFFF" , stroke:9});
  518. slider.control('thumblist' , {autohide:false ,dir:'v'});
  519. }
  520. //27.Appointment Calendar
  521. if($('#appoinment_calendar').length) {
  522. $('#appoinment_calendar').monthly();
  523. }
  524. //28.Scroll to a Specific Div
  525. if($('.scroll-to-target').length){
  526. $(".scroll-to-target").on('click', function() {
  527. var target = $(this).attr('data-target');
  528. // animate
  529. $('html, body').animate({
  530. scrollTop: $(target).offset().top
  531. }, 1000);
  532. });
  533. }
  534. //29.Select menu
  535. function selectDropdown() {
  536. if ($(".selectmenu").length) {
  537. $(".selectmenu").selectmenu();
  538. var changeSelectMenu = function(event, item) {
  539. $(this).trigger('change', item);
  540. };
  541. $(".selectmenu").selectmenu({ change: changeSelectMenu });
  542. };
  543. }
  544. //30.Countdown Timer
  545. if ($('.countdown').length) {
  546. $('.countdown').countdown('2018/1/1', function (event) {
  547. var $this = $(this).html(event.strftime('' + '<div class="counter-column"><span class="count">%D</span><br>Days</div> ' + '<div class="counter-column"><span class="count">%H</span><span class="colon"></span><br>Hours</div> ' + '<div class="counter-column"><span class="count">%M</span><span class="colon"></span><br>Mutines</div> ' + '<div class="counter-column"><span class="count">%S</span><span class="colon"></span><br>Seconds</div>'));
  548. });
  549. }
  550. //31.donate popup
  551. function donatepopup() {
  552. if($('#donate-popup').length){
  553. //Show Popup
  554. $('.donate-box-btn').on('click', function() {
  555. $('#donate-popup').addClass('popup-visible');
  556. });
  557. //Hide Popup
  558. $('.close-donate').on('click', function() {
  559. $('#donate-popup').removeClass('popup-visible');
  560. });
  561. }
  562. }
  563. //32.Elements Animation
  564. if($('.wow').length){
  565. var wow = new WOW(
  566. {
  567. boxClass: 'wow', // animated element css class (default is wow)
  568. animateClass: 'animated', // animation css class (default is animated)
  569. offset: 0, // distance to the element when triggering the animation (default is 0)
  570. mobile: false, // trigger animations on mobile devices (default is true)
  571. live: true // act on asynchronously loaded content (default is true)
  572. }
  573. );
  574. wow.init();
  575. }
  576. /* ==========================================================================
  577. When document is Scrollig, do
  578. ========================================================================== */
  579. jQuery(document).on('ready', function () {
  580. (function ($) {
  581. // add your functions
  582. headerStyle();
  583. progressBarConfig();
  584. selectDropdown();
  585. videoFancybox();
  586. factCounter();
  587. donatepopup()
  588. CounterNumberChanger();
  589. progressBarConfig();
  590. expertizeRoundCircle();
  591. enableMasonry();
  592. })(jQuery);
  593. });
  594. /* ==========================================================================
  595. When document is Scrollig, do
  596. ========================================================================== */
  597. $(window).on('scroll', function() {
  598. headerStyle();
  599. CounterNumberChanger();
  600. });
  601. /* ==========================================================================
  602. When document is loaded, do
  603. ========================================================================== */
  604. $(window).on('load', function() {
  605. handlePreloader();
  606. expertizeRoundCircle();
  607. });
  608. })(window.jQuery);