envor.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905
  1. (function($) {
  2. "use strict";
  3. var bodyW = $('body').width(),
  4. enableMenuAnimate = false;
  5. /*********************************************
  6. Window scroll
  7. *********************************************/
  8. $(window).scroll(function () {
  9. if ($(this).scrollTop() > 40) {
  10. $('#to-the-top').fadeIn();
  11. $('#envor-header-menu').addClass('envor-header-sticked');
  12. $('.envor-content').css('padding-top', $('#envor-header-menu').height() + 'px');
  13. } else {
  14. $('#to-the-top').fadeOut();
  15. $('#envor-header-menu').removeClass('envor-header-sticked');
  16. $('.envor-content').css('padding-top', 0);
  17. }
  18. });
  19. $('#to-the-top').click(function() { $('body,html').animate({scrollTop: 0}, 500); });
  20. /*********************************************
  21. Typography Fix
  22. *********************************************/
  23. $('.envor-about-widget p.contacts').first().css({'border-top-width':'1px', 'margin-top':'30px'});
  24. $('.envor-padding-top-0').find('h2').first().css('margin-top', '0px').css('padding-top', '0px');
  25. $('.envor-content').find('.envor-section').each(function() {
  26. $(this).each(function() {
  27. $(this).find('.row').css('margin-top', '60px').first().css('margin-top', '0px');
  28. $(this).find('.row').each(function() {
  29. if (bodyW < 992) {
  30. $(this).find('[class*="col-"]').css('margin-top','60px').first().css('margin-top','0px');
  31. }
  32. });
  33. });
  34. });
  35. if (bodyW > 768) {
  36. $('.envor-section').each(function() {
  37. $(this).find('[class*="col-"]').each(function() {
  38. $(this).find('h2, h3, h1, h4, h5').first().css('margin-top', '0px');
  39. });
  40. });
  41. }
  42. $('blockquote').each(function() {
  43. var content = $(this).text();
  44. $(this).html('<i class="fa fa-quote-left"></i>' + content + '<i class="fa fa-quote-right"></i>');
  45. $(this).wrapInner('<div class="blockquote-inner"></div>');
  46. });
  47. if (bodyW > 768 && bodyW < 992) {
  48. $('section .col-sm-6').filter(':not(.envor-estate .col-sm-6)').css('margin-top', '60px').eq(0).css('margin-top', '0px').end().eq(1).css('margin-top', '0px');
  49. // $('.envor-footer .col-sm-6').css('margin-top', '60px').eq(0).css('margin-top', '0px').end().eq(1).css('margin-top', '0px');
  50. } else {
  51. $('section .col-sm-6, .envor-footer .col-sm-6').css('margin-top', '0px');
  52. }
  53. $('.envor-feature-2').each(function() {
  54. $(this).children().last().css('margin-bottom','0px');
  55. });
  56. $('.envor-partner-1').each(function() {
  57. var $this = $(this),
  58. H = $this.height(),
  59. h = $this.find('figure').height();
  60. if (H < h)
  61. $this.height(h + 120);
  62. }).last().css('border-bottom-width', '1px');
  63. $('.envor-projects-listing').each(function() {
  64. var $this = $(this),
  65. offset = parseInt($this.find('.envor-listing-item').css('padding-left')),
  66. w = parseInt($this.parents('[class*="col-"]').width()) + offset, h = 0,
  67. $elems = $this.find('.envor-listing-item');
  68. $this.css({
  69. 'margin-left' : -offset,
  70. 'width' : w
  71. });
  72. if ($this.hasClass('envor-projects-listing-3-cols')) {
  73. if (bodyW < 768) {
  74. $elems.width(100 + '%');
  75. } else {
  76. $elems.width($this.width()/3 - 30);
  77. }
  78. }
  79. if ($this.hasClass('envor-projects-listing-4-cols')) {
  80. if (bodyW < 768) {
  81. $elems.width(100 + '%');
  82. } else {
  83. $elems.width($this.width()/4 - 30);
  84. }
  85. }
  86. if ($this.hasClass('envor-projects-listing-5-cols')) {
  87. if (bodyW < 768) {
  88. $elems.width(100 + '%');
  89. } else {
  90. $elems.width($this.width()/5 - 30);
  91. }
  92. }
  93. });
  94. $('.envor-property-2, .envor-property-3').each(function() {
  95. var h = parseInt($(this).find('figure').height());
  96. $(this).find('.envor-property-1-inner').height(h + 2);
  97. });
  98. $('.envor-single-estate').each(function() {
  99. var $this = $(this),
  100. $details = $this.find('.envor-propert-details'),
  101. w = parseInt($details.parents('[class*="col-"]').width());
  102. if (bodyW > 768) {
  103. $details.width(w/3 + 10).first().css('margin-left', '-31px');
  104. $details.find('.inner').css({'padding-left':'30px'});
  105. } else {
  106. $details.width(w).first().css('margin-left', '0px');
  107. $details.find('.inner').css({'padding-left':'0px', 'margin-bottom':'30px'});
  108. $details.last().find('.inner').css('margin-bottom', '0px');
  109. }
  110. });
  111. /*********************************************
  112. Change Product Qty
  113. *********************************************/
  114. $('.shoppin-cart-table').find('tr').each(function() {
  115. var $this = $(this),
  116. $fa = $this.find('i.fa'),
  117. $input = $this.find('input[name*=qty]'),
  118. $total = $this.find('span.total'),
  119. $span = $this.find('.qty-fld'),
  120. price = $this.find('input[name*=price]').val();
  121. $fa.click(function() {
  122. var i = parseInt($span.html());
  123. if ($(this).hasClass('fa-plus')) {
  124. $span.html(i + 1);
  125. $total.html('$' + (i + 1) * price);
  126. }
  127. if ($(this).hasClass('fa-minus')) {
  128. if (i != 1) {
  129. $span.html(i - 1);
  130. $total.html('$' + (i - 1) * price);
  131. }
  132. }
  133. });
  134. }).hover(function() {
  135. $(this).addClass('hover');
  136. }, function() {
  137. $(this).removeClass('hover');
  138. });
  139. /*********************************************
  140. Change Product Qty
  141. *********************************************/
  142. $('#prod-qty').find('i.fa').click(function() {
  143. var $text = $(this).parents('#prod-qty').find('.qty-fld'),
  144. $fld = $('#prod-qty-fld'),
  145. i = parseInt($text.html());
  146. if ($(this).hasClass('fa-plus')) {
  147. $text.html( i + 1);
  148. $fld.val(i + 1);
  149. }
  150. if ($(this).hasClass('fa-minus')) {
  151. if (i != 1) {
  152. $text.html(i - 1);
  153. $fld.val(i - 1);
  154. }
  155. }
  156. });
  157. /*********************************************
  158. Envor Tabs
  159. *********************************************/
  160. $('.envor-tabs').each(function() {
  161. var $this = $(this),
  162. $title = $this.find('header span'),
  163. $article = $this.find('article');
  164. $('<div class="arrow"></div>').appendTo($title);
  165. $article.first().show();
  166. $title.first().addClass('active').end().click(function() {
  167. $title.removeClass('active');
  168. $(this).addClass('active');
  169. $article.hide().eq($(this).index()).fadeIn();
  170. });
  171. });
  172. /*********************************************
  173. Envor Message
  174. *********************************************/
  175. $('.envor-msg').each(function() {
  176. var $this = $(this);
  177. $this.find('.fa').click(function() { $this.fadeOut(); });
  178. });
  179. /*********************************************
  180. Envor Social Button 2
  181. *********************************************/
  182. $('.envor-social-button-2').hover(function() {
  183. $(this).find('.esb-tooltip').stop(true, true).fadeIn();
  184. }, function() {
  185. $(this).find('.esb-tooltip').stop(true, true).fadeOut();
  186. });
  187. /*********************************************
  188. Envor Toggle
  189. *********************************************/
  190. $('.envor-toggle').each(function() {
  191. var $this = $(this),
  192. $article = $this.find('article'),
  193. $header = $article.find('header'),
  194. $content = $article.find('section');
  195. $content.hide();
  196. $header.removeClass('active');
  197. $article.last().css('margin-bottom', '0px');
  198. $article.each(function() {
  199. var $t = $(this);
  200. if ($t.hasClass('open')) {
  201. $t.find('.fa').addClass('fa-minus');
  202. $t.find('header').addClass('active');
  203. $t.find('section').show();
  204. }
  205. });
  206. $header.click(function() {
  207. $header.parent().removeClass('open');
  208. if ($(this).hasClass('active')) {
  209. $(this).find('.fa').removeClass('fa-minus');
  210. $(this).removeClass('active');
  211. $(this).parent().find('section').slideUp();
  212. } else {
  213. $header.removeClass('active');
  214. $content.slideUp();
  215. $header.find('.fa').removeClass('fa-minus');
  216. $(this).find('.fa').addClass('fa-minus');
  217. $(this).addClass('active');
  218. $(this).parent().find('section').slideDown();
  219. }
  220. });
  221. });
  222. /*********************************************
  223. Envor Feature
  224. *********************************************/
  225. $('.envor-feature').each(function() {
  226. $('<span class="arrow-color"></span>').appendTo($(this).find('header'));
  227. });
  228. if (bodyW < 768) {
  229. $('.envor-feature, .envor-feature-2').last().css('margin-bottom', '0px');
  230. }
  231. /*********************************************
  232. Animation
  233. *********************************************/
  234. $('.envor-header-2 .envor-header-bg .social-buttons ul li a').hover(function() {
  235. $(this).find('i').addClass('animated rotateIn');
  236. }, function() {
  237. $(this).find('i').removeClass('animated rotateIn');
  238. });
  239. $('.envor-section-twitter-1').hover(function() { $(this).find('i.fa-twitter').addClass('animated bounceIn'); }, function() { $(this).find('i.fa-twitter').removeClass('animated bounceIn'); });
  240. $('.envor-feature-store').each(function() {
  241. $('<span class="arrow"></span>').prependTo($(this));
  242. }).hover(function() {
  243. $(this).find('i').addClass('animated rotateIn');
  244. }, function() {
  245. $(this).find('i').removeClass('animated rotateIn');
  246. });
  247. $('.envor-feature-3, .envor-feature-3').hover(function() {
  248. $(this).find('.fa, .glyphicon').addClass('animated rotateIn');
  249. }, function() {
  250. $(this).find('.fa, .glyphicon').removeClass('animated rotateIn');
  251. });
  252. /*********************************************
  253. Envor Estate Form
  254. *********************************************/
  255. $('.envor-estate-search-type span').on('click', function() {
  256. $('.envor-estate-search-type span').removeClass('active');
  257. $(this).addClass('active').parent().find('input').val($(this).attr('data-val'));
  258. });
  259. $('.envor-estate-form-item').each(function() {
  260. var $this = $(this),
  261. $span = $this.find('span.val'),
  262. $list = $this.find('.envor-efi-list'),
  263. $checked = $list.find('input[type=checkbox]');
  264. if ($list.find('> p').length > 8)
  265. $list.css({
  266. 'overflow':'scroll',
  267. 'overflow-x':'hidden'
  268. });
  269. $this.find('i.fa-caret-down').click(function() {
  270. $list.slideToggle();
  271. $(this).toggleClass('fa-caret-up');
  272. });
  273. $checked.on('click', function() {
  274. var $c = $checked.filter(':checked');
  275. if ($c.length == 1) {
  276. $span.html($c.val());
  277. }
  278. if ($c.length == 0) {
  279. $span.html('Choose...');
  280. }
  281. if ($c.length > 1) {
  282. $span.html('Multiple');
  283. }
  284. });
  285. });
  286. /*********************************************
  287. Top bar social buttons
  288. *********************************************/
  289. $('.envor-top-bar').find('ul.social-btns li').each(function() {
  290. var $this = $(this),
  291. $a = $this.find('a'),
  292. $aFirst = $a.first();
  293. $a.addClass('regular').clone().removeClass('regular').addClass('hover').appendTo($this);
  294. $this.hover(function() {
  295. $(this).find('a.regular').stop(true, true).animate({'top':'-40px'}, 200);
  296. $(this).find('a.hover').stop(true, true).animate({'top':'0px'}, 200);
  297. }, function() {
  298. $(this).find('a.regular').stop(true, true).animate({'top':'0px'}, 200);
  299. $(this).find('a.hover').stop(true, true).animate({'top':'40px'}, 200);
  300. });
  301. });
  302. /*********************************************
  303. Top bar shopping cart
  304. *********************************************/
  305. $('.envor-top-bar .shopping-cart').each(function() {
  306. $(this).find(' > span i.fa').addClass('regular').clone().removeClass('regular').appendTo($(this).find(' > span')).addClass('hover');
  307. $(this).hover(function() {
  308. $(this).find(' > span i.regular').stop(true, true).animate({'top':'-40px'}, 200);
  309. $(this).find(' > span i.hover').stop(true, true).animate({'top':'0px'}, 200);
  310. $(this).find('.cart').stop(true, true).fadeIn();
  311. }, function() {
  312. $(this).find(' > span i.regular').stop(true, true).animate({'top':'0px'}, 200);
  313. $(this).find(' > span i.hover').stop(true, true).animate({'top':'40px'}, 200);
  314. $(this).find('.cart').stop(true, true).fadeOut();
  315. });
  316. var $ul = $(this).find('.cart .cart-entry');
  317. // $ul.jScrollPane();
  318. $('#topbarcart').mCustomScrollbar()
  319. $(this).find('.cart').hide();
  320. });
  321. /*********************************************
  322. Top bar desktop menu
  323. *********************************************/
  324. var megaMenuIndex = 0;
  325. $('.envor-header-1 .envor-header-bg nav > ul > li, .envor-header-1 .envor-header-bg nav > ul > li ul > li, .envor-header-2 .envor-desktop-menu-bg nav li, .envor-header-3 .envor-desktop-menu-bg nav li').filter(':not(.envor-mega li)').each(function() {
  326. $('<span class="hover"></span>').appendTo($(this));
  327. }).hover(function() {
  328. $(this).find('> .hover').stop(true, true).fadeIn(200);
  329. }, function() {
  330. $(this).find('> .hover').stop(true, true).fadeOut(200);
  331. });
  332. $('.envor-header-1 .envor-header-bg nav li, .envor-header-2 .envor-desktop-menu-bg nav li, .envor-header-3 .envor-desktop-menu-bg nav li').hover(function() {
  333. var $ul = $(this).find('> ul'),
  334. $mega = $(this).find('.envor-mega');
  335. if ($ul.length > 0) {
  336. if (enableMenuAnimate) {
  337. $ul.show().addClass('animated flipInY');
  338. } else {
  339. $ul.stop(true,true).fadeIn();
  340. }
  341. }
  342. if ($mega.length > 0) {
  343. if (enableMenuAnimate) {
  344. $mega.show().addClass('animated flipInY');
  345. } else {
  346. $mega.fadeIn();
  347. }
  348. }
  349. }, function() {
  350. var $ul = $(this).find('> ul'),
  351. $mega = $(this).find('.envor-mega');
  352. if (enableMenuAnimate) {
  353. $ul.removeClass('animated flipInY').fadeOut(200);
  354. $mega.removeClass('animated flipInY').fadeOut(200);
  355. } else {
  356. $ul.stop(true,true).fadeOut();
  357. $mega.stop(true,true).fadeOut();
  358. }
  359. });
  360. $('.envor-header-1 .envor-header-bg nav > ul > li, .envor-header-2 .envor-desktop-menu-bg nav > ul > li').each(function() {
  361. var $mega = $(this).find('.envor-mega');
  362. if ($mega.length != 0) {
  363. megaMenuIndex = $(this).index();
  364. }
  365. }).hover(function() {
  366. var l = $('.envor-header nav > ul > li').length;
  367. if ($(this).index() == (l - 1)) {
  368. $(this).find('> ul').addClass('left');;
  369. }
  370. });
  371. /*********************************************
  372. Mega Menu
  373. *********************************************/
  374. function envorMegaMenu() {
  375. if ($('.envor-header-1 .envor-mega').length != 0) {
  376. var $mega = $('.envor-mega'),
  377. $items = $mega.find('.envor-mega-section'),
  378. $menu = $('.envor-header-1 .envor-header-bg nav > ul > li'),
  379. rightOffset = 0, h = 0, w = 100 / $items.length;
  380. $menu.slice(megaMenuIndex + 1).each(function() {
  381. rightOffset = rightOffset
  382. + $(this).width()
  383. + parseInt($(this).css('padding-left'))
  384. + parseInt($(this).css('padding-right'))
  385. + parseInt($(this).css('border-left-width'))
  386. + parseInt($(this).css('border-right-width'));
  387. });
  388. $mega.width($('.col-lg-12').width()).css('right', '-' + rightOffset + 'px');
  389. $items.each(function() { $(this).width($('.col-lg-12').width() / $items.length - 31); }).first().css('border-left-width', '0px');
  390. $items.each(function() {
  391. $(this).find('li').last().css('border-bottom-width', '0px');
  392. if ($(this).height() > h)
  393. h = $(this).height();
  394. }).css('height', h + parseInt($items.css('padding-top')) + parseInt($items.css('padding-bottom')) + 'px');
  395. $mega.height(h + parseInt($items.css('padding-top')) + parseInt($items.css('padding-bottom')) + 'px').hide();
  396. }
  397. if ($('.envor-header-2 .envor-mega').length != 0) {
  398. var $mega = $('.envor-mega'),
  399. $items = $mega.find('.envor-mega-section'),
  400. $menu = $('.envor-header-2 .envor-desktop-menu-bg nav > ul > li'),
  401. leftOffset = 0, h = 0, w = 100 / $items.length;
  402. $menu.slice(0, megaMenuIndex).each(function() {
  403. leftOffset = leftOffset
  404. + $(this).width()
  405. + parseInt($(this).css('padding-left'))
  406. + parseInt($(this).css('padding-right'))
  407. + parseInt($(this).css('border-left-width'))
  408. + parseInt($(this).css('border-right-width'));
  409. });
  410. $mega.width($('.col-lg-12').width()).css('left', '-' + leftOffset + 'px');
  411. $items.each(function() { $(this).width($('.col-lg-12').width() / $items.length - 31); }).first().css('border-left-width', '0px');
  412. $items.each(function() {
  413. $(this).find('li').last().css('border-bottom-width', '0px');
  414. if ($(this).height() > h)
  415. h = $(this).height();
  416. }).css('height', h + parseInt($items.css('padding-top')) + parseInt($items.css('padding-bottom')) + 'px');
  417. $mega.height(h + parseInt($items.css('padding-top')) + parseInt($items.css('padding-bottom')) + 'px').hide();
  418. }
  419. if ($('.envor-header-3 .envor-mega').length != 0) {
  420. var $mega = $('.envor-mega'),
  421. $items = $mega.find('.envor-mega-section'),
  422. offset, offsetLeft = 0, h = 0, w = 100 / $items.length;
  423. offset = $mega.offset();
  424. offsetLeft = offset.left - ($(window).width() - $('.col-lg-12').width()) / 2 - parseInt($('.col-lg-12').css('padding-left'));
  425. $mega.width($('.col-lg-12').width()).css('left', '-' + offsetLeft + 'px');
  426. $items.each(function() { $(this).width($('.col-lg-12').width() / $items.length - 31); }).first().css('border-left-width', '0px');
  427. $items.each(function() {
  428. $(this).find('li').last().css('border-bottom-width', '0px');
  429. if ($(this).height() > h)
  430. h = $(this).height();
  431. }).css('height', h + parseInt($items.css('padding-top')) + parseInt($items.css('padding-bottom')) + 'px');
  432. $mega.height(h + parseInt($items.css('padding-top')) + parseInt($items.css('padding-bottom')) + 'px').hide();
  433. }
  434. }
  435. envorMegaMenu();
  436. /*********************************************
  437. Envor Links Widget
  438. *********************************************/
  439. $('<span class="border"></span>').appendTo($('.envor-links-widget li'));
  440. $('.envor-links-widget ul > li').last().find('.border').remove().detach();
  441. /*********************************************
  442. Envor Category Widget
  443. *********************************************/
  444. $('.envor-category-widget ul li').hover(function() {
  445. $(this).find('p span').addClass('hovered');
  446. }, function() {
  447. $(this).find('p span').removeClass('hovered');
  448. });
  449. /*********************************************
  450. Mobile Menu
  451. *********************************************/
  452. var $mobileMenu = $('.envor-mobile-menu nav'), isMobileMenuShown = 1;
  453. $mobileMenu.css('max-height', $(window).height() - 40);
  454. $mobileMenu.mCustomScrollbar();
  455. $('<span class="border"></span>').appendTo($mobileMenu.find('ul li'));
  456. $('<span class="border"></span>').appendTo($mobileMenu);
  457. $mobileMenu.find('li').each(function() {
  458. var $ul = $(this).find('> ul');
  459. if ($ul.length > 0)
  460. $('<i class="glyphicon glyphicon-plus-sign"></i>').appendTo($(this));
  461. var $i = $(this).find('> i.glyphicon-plus-sign');
  462. $i.click(function() {
  463. $(this).toggleClass('glyphicon-minus-sign');
  464. if ($(this).hasClass('glyphicon-minus-sign')) {
  465. $(this).parent('li').find('> ul').show();
  466. } else {
  467. $(this).parent('li').find('> ul').hide();
  468. }
  469. $mobileMenu.mCustomScrollbar('update');
  470. });
  471. });
  472. $mobileMenu.mCustomScrollbar('update');
  473. $('#envor-mobile-menu-btn').click(function() {
  474. if (isMobileMenuShown) {
  475. $('#envor-mobile-menu').animate({
  476. 'right':'0px'
  477. });
  478. $(this).animate({
  479. 'right':'200px'
  480. });
  481. isMobileMenuShown = 0;
  482. } else {
  483. $('#envor-mobile-menu').animate({
  484. 'right':'-200px'
  485. });
  486. $(this).animate({
  487. 'right':'0px'
  488. });
  489. isMobileMenuShown = 1;
  490. }
  491. $(this).toggleClass('clicked');
  492. });
  493. $('#envor-mobile-cart-btn').click(function() {
  494. if (isMobileMenuShown) {
  495. $('#envor-mobile-cart').animate({
  496. 'right':'0px'
  497. });
  498. $(this).animate({
  499. 'right':'200px'
  500. });
  501. isMobileMenuShown = 0;
  502. } else {
  503. $('#envor-mobile-cart').animate({
  504. 'right':'-200px'
  505. });
  506. $(this).animate({
  507. 'right':'0px'
  508. });
  509. isMobileMenuShown = 1;
  510. }
  511. $(this).toggleClass('clicked');
  512. });
  513. /*********************************************
  514. Header #2 Search
  515. *********************************************/
  516. var $h2Search = $('.envor-header-2 .envor-header-bg .header-search form');
  517. $h2Search.find('input[type=text]').on('focus', function() { $h2Search.addClass('focus'); $(this).animate({'width':'150px'}); $h2Search.find('button[type=submit]').addClass('focus'); } );
  518. $h2Search.find('input[type=text]').on('blur', function() { $h2Search.removeClass('focus'); $(this).animate({'width':'80px'}); $h2Search.find('button[type=submit]').removeClass('focus'); } );
  519. /*********************************************
  520. Figure fix
  521. *********************************************/
  522. function envorProject() {
  523. var $projects = $('.envor-project');
  524. $projects.each(function() {
  525. });
  526. }
  527. setTimeout(function() {
  528. envorProject();
  529. }, 1000);
  530. $('.envor-project, .envor-property-1, .envor-product-1, .envor-post-preview, .envor-post').hover(function() {
  531. $(this).find('figure figcaption').stop(true,true).fadeIn(200).find('i').stop(true,true).animate({'top':'50%'}, 200);
  532. }, function() {
  533. $(this).find('figure figcaption').find('i').stop(true,true).animate({'top':'0'}, 200).end().stop(true,true).fadeOut(200);
  534. });
  535. /*********************************************
  536. Clorbox links
  537. *********************************************/
  538. $('a.colorbox').colorbox();
  539. /*********************************************
  540. Envor Partner Logo
  541. *********************************************/
  542. var envorLogoH = 0;
  543. $('.envor-partner-logo').each(function() {
  544. $(this).find('img').fadeTo(0, 0.3);
  545. if ($(this).find('img').height() > envorLogoH) {
  546. envorLogoH = $(this).height();
  547. }
  548. }).height(envorLogoH - parseInt($('.envor-partner-logo .inner').css('padding-left')) - parseInt($('.envor-partner-logo .inner').css('padding-right'))).hover(function() {
  549. $(this).find('img').stop(true,true).fadeTo(400, 1);
  550. }, function() {
  551. $(this).find('img').stop(true,true).fadeTo(400, 0.3);
  552. });
  553. /*********************************************
  554. Envor Career 1
  555. *********************************************/
  556. $('.envor-career-1').each(function() {
  557. var $ec = $(this);
  558. $(this).find('a.show-details').click(function(e) {
  559. e.preventDefault();
  560. $(this).find('i.fa').toggleClass('fa-minus');
  561. $ec.find('.details').slideToggle();
  562. });
  563. }).last().css('border-bottom-width', '1px');
  564. /*********************************************
  565. Envor Pricing 1 Header .plan-price
  566. *********************************************/
  567. $('.envor-pricing-1 header .plan-price').each(function() {
  568. $('<span class="arrow"></span>').prependTo($(this));
  569. });
  570. /*********************************************
  571. Envor Pricing 2
  572. *********************************************/
  573. function envorPricing2() {
  574. $('.envor-pricing-2').each(function() {
  575. var $this = $(this),
  576. $elems = $this.find('.envor-pricing-2-item'),
  577. index = 0,
  578. qty = $elems.length;
  579. $elems.each(function() {
  580. if ($('body').width() > 768) {
  581. $(this).width($this.width() / qty);
  582. } else {
  583. $(this).css('width', '100%');
  584. }
  585. if ($(this).hasClass('envor-pricing-2-item-featured'))
  586. index = $(this).index();
  587. }).last().css('border-right-width', '1px').end().eq(index + 1).css('border-left-width', '0px');
  588. });
  589. }
  590. envorPricing2();
  591. /*********************************************
  592. Envor Domains
  593. *********************************************/
  594. $('.envor-domain-search form .envor-domain-search-inner div.zone i').on('click', function() {
  595. $(this).toggleClass('fa-caret-up');
  596. $(this).parent().find('> ul').slideToggle();
  597. });
  598. var divZone = $('.envor-domain-search form .envor-domain-search-inner div.zone span');
  599. var divZoneLi = $('.envor-domain-search form .envor-domain-search-inner div.zone ul li');
  600. divZoneLi.click(function() {
  601. divZone.html('.' + $(this).attr('data-val'));
  602. $(this).parent().slideUp();
  603. $('.envor-domain-search form .envor-domain-search-inner input[name=domain_zone]').val($(this).attr('data-val'))
  604. $('.envor-domain-search form .envor-domain-search-inner div.zone i').removeClass('fa-caret-up');
  605. });
  606. $('.envor-domain-price').each(function() {
  607. ;
  608. }).hover(function() {
  609. $(this).css('position', 'relative').stop(true, true).animate({'margin-top':'-5px'}, 200);
  610. }, function() {
  611. $(this).css('position', 'relative').stop(true, true).animate({'margin-top':'0px'}, 200);
  612. });
  613. /*********************************************
  614. Simple Twitter Widget
  615. *********************************************/
  616. setTimeout(function() {
  617. $('.envor-simple-twiiter-widget ul li').each(function() {
  618. $('<i class="fa fa-twitter"></i>').appendTo($(this));
  619. }).last().css({
  620. 'margin-bottom': '0px'
  621. });
  622. }, 2000);
  623. /*********************************************
  624. Mobile Shopping Cart
  625. *********************************************/
  626. $('.envor-mobile-cart-list').css('max-height', $(window).height() - 40);
  627. $('<span class="border"></span>').appendTo($('.envor-mobile-cart-list p'));
  628. $('<span class="border"></span>').appendTo($('#envor-mobile-cart h3'));
  629. $('.envor-mobile-cart-list').mCustomScrollbar();
  630. /*********************************************
  631. Envor Animate Skill
  632. *********************************************/
  633. function envorAnimateSkill() {
  634. $('.envor-skill-1').each(function() {
  635. var $this = $(this),
  636. w = $this.width(),
  637. val = $this.find('.value').attr('data-value'),
  638. $c1 = $this.find('.color-1'),
  639. $c2 = $this.find('.color-2'),
  640. $wrapper = $this.find('.color-2-wrapper'),
  641. $inner = $this.find('.inner'),
  642. $p = $this.find('.value p');
  643. $c1.height(w);
  644. $c2.height(w);
  645. $inner.height(w - 20).width(w - 20).css('line-height', (w - 20) + 'px');
  646. $wrapper.animate({ 'height': (w * val/100) + 'px'}, 400);
  647. });
  648. }
  649. envorAnimateSkill();
  650. /*********************************************
  651. Envor Skill 2
  652. *********************************************/
  653. $('.envor-skill-2').each(function() {
  654. var $this = $(this),
  655. $color = $('<span class="color"></span>'),
  656. $bg = $('<span class="bg"></span>'),
  657. $p = $('<p></p>');
  658. $color.appendTo($this).width($this.attr('data-value'));
  659. $p.appendTo($this).html($this.attr('data-name') + ': <strong>' + $this.attr('data-value') + '</strong>').width($this.attr('data-value'));
  660. $bg.appendTo($color).fadeTo(0, 0.05);
  661. }).last().css('margin-bottom', '0px');
  662. /*********************************************
  663. Envor Message
  664. *********************************************/
  665. $('.envor-msg').each(function() {
  666. var $this = $(this);
  667. $this.find('.fa').click(function() { $this.fadeOut(); });
  668. });
  669. /*********************************************
  670. 404 Page
  671. *********************************************/
  672. $('.envor-content-404, .envor-content-404-gradient').height($(window).height() - 40);
  673. $('.envor-content-404-inner').height($(window).height() - 40 - $('#socials').height() - parseInt($('#socials').css('padding-top')) - parseInt($('#socials').css('padding-bottom')));
  674. if ($(window).height() < 900)
  675. $('.envor-content-404 .envor-soc-buttons-list').css('position','relative').css('margin-top','50px');
  676. $('<span class="line"></span>').appendTo($('.riva-countdown .riva-countdown-item .value'));
  677. /*********************************************
  678. Envor f1 form
  679. *********************************************/
  680. $('#create-an-account-div').hide();
  681. $('#create-an-account').change(function() {
  682. if ($(this).is(':checked')) {
  683. $('#create-an-account-div').fadeIn();
  684. } else {
  685. $('#create-an-account-div').hide();
  686. }
  687. });
  688. $('#ship-to-billing-address-div').hide();
  689. $('#ship-to-billing-address').change(function() {
  690. if ($(this).is(':checked')) {
  691. $('#ship-to-billing-address-div').hide();
  692. } else {
  693. $('#ship-to-billing-address-div').fadeIn();
  694. }
  695. });
  696. $('.payment-option span').click(function() {
  697. $('.payment-option').removeClass('payment-option-active');
  698. $(this).parents('.payment-option').addClass('payment-option-active');
  699. $('input[name=payment-option]').val($(this).parents('.payment-option').attr('data-payment'));
  700. });
  701. /*********************************************
  702. Settings
  703. *********************************************/
  704. var showSettings = 0;
  705. $('.envor-settings i.fa-cog').click(function() {
  706. if (showSettings) {
  707. $(this).parents('.envor-settings').animate({'left':'-240px'});
  708. showSettings = 0;
  709. } else {
  710. $(this).parents('.envor-settings').animate({'left':'0px'});
  711. showSettings = 1;
  712. }
  713. });
  714. $('.envor-settings ul [class*="p"]').click(function() {
  715. $('.envor-boxed-bg').css('background-image', 'url(../img/settings/pat' + $(this).attr('data-value') + '.png)');
  716. });
  717. $('.envor-settings ul [class*="s"]').click(function() {
  718. $('#envor-site-color').attr('href', 'css/color' + $(this).attr('data-value') + '.css');
  719. $('#envor-site-boxed-color').attr('href', '../css/color' + $(this).attr('data-value') + '.css');
  720. });
  721. /*********************************************
  722. On Window Resize
  723. *********************************************/
  724. $( window ).resize(function() {
  725. envorProject();
  726. envorMegaMenu();
  727. bodyW = $('body').width();
  728. if (bodyW > 768 && bodyW < 992) {
  729. $('section .col-sm-6').css('margin-top', '60px').eq(0).css('margin-top', '0px').end().eq(1).css('margin-top', '0px');
  730. //$('.envor-footer .col-sm-6').css('margin-top', '60px').eq(0).css('margin-top', '0px').end().eq(1).css('margin-top', '0px');
  731. } else {
  732. $('section .col-sm-6, .envor-footer .col-sm-6').css('margin-top', '0px');
  733. }
  734. if (bodyW < 768) {
  735. $('.envor-feature').last().css('margin-bottom', '0px');
  736. }
  737. envorAnimateSkill();
  738. if ($(window).height() < 900)
  739. $('.envor-content-404 .envor-soc-buttons-list').css('position','relative');
  740. $('.envor-projects-listing').each(function() {
  741. var $this = $(this),
  742. offset = parseInt($this.find('.envor-listing-item').css('padding-left')),
  743. w = parseInt($this.parents('[class*="col-"]').width()), h,
  744. $elems = $this.find('.envor-listing-item');
  745. $this.css({
  746. 'margin-left' : -offset,
  747. 'width' : w + offset
  748. });
  749. if ($this.hasClass('envor-projects-listing-3-cols')) {
  750. if (bodyW < 768) {
  751. $elems.width(w);
  752. }
  753. if (bodyW > 768 && bodyW < 992) {
  754. $elems.width((w + offset)/2 - offset);
  755. }
  756. if (bodyW > 992) {
  757. $elems.width((w + offset)/3 - offset);
  758. }
  759. }
  760. if ($this.hasClass('envor-projects-listing-4-cols')) {
  761. if (bodyW < 768) {
  762. $elems.width(w);
  763. }
  764. if (bodyW > 768 && bodyW < 992) {
  765. $elems.width((w + offset)/2 - offset);
  766. }
  767. if (bodyW > 992) {
  768. $elems.width((w + offset)/4 - offset);
  769. }
  770. }
  771. if ($this.hasClass('envor-projects-listing-5-cols')) {
  772. if (bodyW < 768) {
  773. $elems.width(w);
  774. }
  775. if (bodyW > 768 && bodyW < 992) {
  776. $elems.width((w + offset)/2 - offset);
  777. }
  778. if (bodyW > 992) {
  779. $elems.width((w + offset)/5 - offset);
  780. }
  781. }
  782. });
  783. $('.envor-single-estate').each(function() {
  784. var $this = $(this),
  785. $details = $this.find('.envor-propert-details'),
  786. w = parseInt($details.parents('[class*="col-"]').width());
  787. if (bodyW > 768) {
  788. $details.width(w/3 + 10).first().css('margin-left', '-31px');
  789. $details.find('.inner').css({'padding-left':'30px'});
  790. } else {
  791. $details.width(w).first().css('margin-left', '0px');
  792. $details.find('.inner').css({'padding-left':'0px', 'margin-bottom':'30px'});
  793. $details.last().find('.inner').css('margin-bottom', '0px');
  794. }
  795. });
  796. });
  797. })(jQuery);