In this repo i store all my websites, each in a different branch
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

665 lignes
23 KiB

  1. $(function () {
  2. "use strict";
  3. $(window).load(function () {
  4. // SITE PRELOADER ||-----------
  5. $('#loader').fadeOut();
  6. $('#preloader').delay(350).fadeOut('slow');
  7. $('body').delay(350).css({ 'overflow': 'visible' });
  8. // Portfolio Grid Masonry
  9. containerGridMasonry();
  10. })
  11. // ---------------------------------------------------------------------------------------------------------------------------->
  12. // GENERAL SCRIPTS FOR ALL PAGES ||-----------
  13. // ---------------------------------------------------------------------------------------------------------------------------->
  14. $(document).ready(function () {
  15. fullScreenSlider();
  16. stickHeader();
  17. int_introHeight();
  18. scroll();
  19. pluginElement();
  20. sliderHero();
  21. sliderAll();
  22. containerGridMasonry();
  23. scrollCallbackEle();
  24. shortcodeElements();
  25. });
  26. $(window).resize(function () {
  27. stickHeader();
  28. int_introHeight();
  29. })
  30. $(window).scroll(function () {
  31. stickHeader();
  32. });
  33. // ---------------------------------------------------------------------------------------------------------------------------->
  34. // SCROLL FUNCTIONS ||-----------
  35. // ---------------------------------------------------------------------------------------------------------------------------->
  36. function scroll() {
  37. // //Click Event to Scroll to Top
  38. $(window).scroll(function () {
  39. if ($(this).scrollTop() > 300) {
  40. $('.scroll-top').fadeIn();
  41. } else {
  42. $('.scroll-top').fadeOut();
  43. }
  44. });
  45. $('.scroll-top').click(function () {
  46. $('html, body').animate({ scrollTop: 0 }, 800);
  47. return false;
  48. });
  49. // Scroll Down Elements
  50. $('.scroll-down[href^="#"], .scroll-to-target[href^="#"]').on('click', function (e) {
  51. e.preventDefault();
  52. var target = this.hash;
  53. var $target = $(target);
  54. $('html, body').stop().animate({
  55. 'scrollTop': $target.offset().top
  56. }, 900, 'swing', function () {
  57. window.location.hash = target;
  58. });
  59. });
  60. };
  61. // ---------------------------------------------------------------------------------------------------------------------------->
  62. // STICKY HEADER FUNCTIONS ||-----------
  63. // ---------------------------------------------------------------------------------------------------------------------------->
  64. function stickHeader() {
  65. var scrolled = $(window).scrollTop();
  66. var windHeight = $(window).height();
  67. if (scrolled > 150) {
  68. $('.header').addClass('header-prepare');
  69. } else {
  70. $('.header').removeClass('header-prepare');
  71. }
  72. if (scrolled > 1) {
  73. $('.header').addClass('header-fixed');
  74. } else {
  75. $('.header').removeClass('header-fixed');
  76. }
  77. };
  78. // ----------------------------------------------------------------
  79. // Intro Height
  80. // ----------------------------------------------------------------
  81. function int_introHeight() {
  82. var windiwHeight = $(window).height();
  83. // Intro Height
  84. $('.js-fullscreen-height').css('height', windiwHeight);
  85. };
  86. // ----------------------------------------------------------------
  87. // Backgrounds Image (Slider, Section, etc..)
  88. // ----------------------------------------------------------------
  89. var pageSection = $('.slide-bg-image, .bg-image');
  90. pageSection.each(function (indx) {
  91. if ($(this).attr("data-background-img")) {
  92. $(this).css("background-image", "url(" + $(this).data("background-img") + ")");
  93. }
  94. });
  95. // ---------------------------------------------------------------------------------------------------------------------------->
  96. // FULLSCREEN SLIDER FUNCTIONS ||-----------
  97. // ---------------------------------------------------------------------------------------------------------------------------->
  98. function fullScreenSlider() {
  99. if ($('.fullscreen-carousel').length > 0) {
  100. $('.fullscreen-carousel').flexslider({
  101. animation: "slide",
  102. // startAt: 0,
  103. animationSpeed: 700,
  104. animationLoop: true,
  105. slideshow: true,
  106. easing: "swing",
  107. controlNav: false,
  108. before: function (slider) {
  109. //Slide Caption Animate
  110. $('.fullscreen-carousel .intro-content-inner').fadeOut().animate({ top: '80px' }, { queue: false, easing: 'easeOutQuad', duration: 700 });
  111. slider.slides.eq(slider.currentSlide).delay(400);
  112. slider.slides.eq(slider.animatingTo).delay(400);
  113. },
  114. after: function (slider) {
  115. //Slide Caption Animate
  116. $('.fullscreen-carousel .flex-active-slide').find('.intro-content-inner').fadeIn(2000).animate({ top: '0' }, { queue: false, easing: 'easeOutQuad', duration: 1200 });
  117. // Header Dark Light
  118. headerDarkLight_with_flexslider();
  119. },
  120. start: function (slider) {
  121. $('body').removeClass('loading');
  122. // Header Dark Light
  123. headerDarkLight_with_flexslider();
  124. },
  125. useCSS: true,
  126. });
  127. };
  128. // Header Dark Light
  129. function headerDarkLight_with_flexslider() {
  130. var color = $('.fullscreen-carousel').find('li.flex-active-slide').attr('data-slide');
  131. if (color == 'dark-slide') {
  132. $('#header').addClass('header').removeClass('header-light');
  133. $('#header').removeClass('header-default');
  134. }
  135. if (color == 'light-slide') {
  136. $('#header').addClass('header-light').removeClass('header-dark');
  137. $('#header').removeClass('header-default');
  138. }
  139. if (color == 'default-slide') {
  140. $('#header').removeClass('header-dark');
  141. $('#header').removeClass('header-light');
  142. $('#header').addClass('header');
  143. }
  144. };
  145. // "fullscreen-carousel" height
  146. fullScreenCarousel();
  147. function fullScreenCarousel() {
  148. var windowWidth = $(window).width();
  149. var windowHeight = $(window).height();
  150. if ($(window).width() > 767) {
  151. $('.hero-slider-1 .slides .js-Slide-fullscreen-height').css("height", windowHeight);
  152. }
  153. else {
  154. $('.hero-slider-1 .slides .js-Slide-fullscreen-height').css("height", '400px');
  155. }
  156. };
  157. $(window).resize(function () {
  158. fullScreenCarousel();
  159. });
  160. };
  161. // ---------------------------------------------------------------------------------------------------------------------------->
  162. // SLIDER FUNCTIONS ||-----------
  163. // ---------------------------------------------------------------------------------------------------------------------------->
  164. function sliderAll() {
  165. // fullwidth Slider
  166. $('.fullwidth-slider').owlCarousel({
  167. slideSpeed: 400,
  168. singleItem: true,
  169. autoHeight: true,
  170. navigation: true, // Show next and prev buttons
  171. pagination: true, // Show pagination buttons
  172. navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"],
  173. });
  174. // Image Slider
  175. $('.image-slider').owlCarousel({
  176. navigation: true, // Show next and prev buttons
  177. pagination: true, // Show pagination buttons
  178. slideSpeed: 350,
  179. paginationSpeed: 400,
  180. singleItem: true,
  181. navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"],
  182. autoPlay: false,
  183. autoHeight: true,
  184. responsive: true
  185. });
  186. // Testimonial Slider
  187. $('.testimonial-carousel').owlCarousel({
  188. autoPlay: true,
  189. autoHeight: true,
  190. stopOnHover: true,
  191. singleItem: true,
  192. slideSpeed: 350,
  193. pagination: true, // Show pagination buttons
  194. navigation: false, // Hide next and prev buttons
  195. navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"],
  196. // responsive: true
  197. });
  198. // Team Carousel
  199. $('.team-carousel').owlCarousel({
  200. autoPlay: false,
  201. stopOnHover: true,
  202. items: 3,
  203. itemsDesktop: [1170, 3],
  204. itemsDesktopSmall: [1024, 2],
  205. itemsTabletSmall: [768, 1],
  206. itemsMobile: [480, 1],
  207. pagination: false, // Hide pagination buttons
  208. navigation: false, // Hide next and prev buttons
  209. navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"]
  210. });
  211. // Client Carousel
  212. $('.client-carousel').owlCarousel({
  213. autoPlay: 2500,
  214. stopOnHover: true,
  215. items: 5,
  216. itemsDesktop: [1170, 4],
  217. itemsDesktopSmall: [1024, 3],
  218. itemsTabletSmall: [768, 2],
  219. itemsMobile: [480, 1],
  220. pagination: false, // hide pagination buttons
  221. navigation: false, // hide next and prev buttons
  222. navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"]
  223. });
  224. // Content Slider
  225. $('.content-carousel').owlCarousel({
  226. autoPlay: true,
  227. autoHeight: true,
  228. stopOnHover: true,
  229. singleItem: true,
  230. slideSpeed: 500,
  231. pagination: false, // Hide pagination buttons
  232. navigation: true, // Show next and prev buttons
  233. navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"],
  234. responsive: true
  235. });
  236. // Item-5 Carousel
  237. $('.item5-carousel').owlCarousel({
  238. autoPlay: 2500,
  239. stopOnHover: true,
  240. items: 5,
  241. itemsDesktop: [1170, 3],
  242. itemsDesktopSmall: [1024, 2],
  243. itemsTabletSmall: [768, 1],
  244. itemsMobile: [480, 1],
  245. pagination: true, // Show pagination buttons
  246. navigation: true, // Show next and prev buttons
  247. navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"]
  248. });
  249. // Item-4 Carousel
  250. $('.item4-carousel').owlCarousel({
  251. autoPlay: 2500,
  252. stopOnHover: true,
  253. items: 4,
  254. itemsDesktop: [1170, 3],
  255. itemsDesktopSmall: [1024, 2],
  256. itemsTabletSmall: [768, 1],
  257. itemsMobile: [480, 1],
  258. pagination: false, // Hide pagination buttons
  259. navigation: true, // Show next and prev buttons
  260. navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"]
  261. });
  262. // Item-3 Carousel
  263. $('.item3-carousel').owlCarousel({
  264. autoPlay: false,
  265. stopOnHover: true,
  266. items: 3,
  267. itemsDesktop: [1170, 3],
  268. itemsDesktopSmall: [1024, 2],
  269. itemsTabletSmall: [768, 1],
  270. itemsMobile: [480, 1],
  271. pagination: true, // show pagination buttons
  272. navigation: true, // Show next and prev buttons
  273. navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"]
  274. });
  275. // Item-1 Carousel
  276. $('.item1-carousel').owlCarousel({
  277. autoPlay: false,
  278. autoHeight: true,
  279. stopOnHover: true,
  280. singleItem: true,
  281. slideSpeed: 350,
  282. pagination: true, // Show pagination buttons
  283. navigation: true, // Show next and prev buttons
  284. navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"],
  285. responsive: true
  286. });
  287. };
  288. // ---------------------------------------------------------------------------------------------------------------------------->
  289. // SLIDER-HERO FUNCTIONS ||-----------
  290. // ---------------------------------------------------------------------------------------------------------------------------->
  291. function sliderHero() {
  292. $('.slider-hero').owlCarousel({
  293. navigation: true, // Show next and prev buttons
  294. slideSpeed: 700,
  295. paginationSpeed: 400,
  296. pagination: true,
  297. addClassActive: true,
  298. touchDrag: true,
  299. singleItem: true,
  300. navigationText: false,
  301. autoPlay: false,
  302. autoHeight: false,
  303. //responsive: true,
  304. //itemsDesktop: [3000, 1],
  305. //itemsDesktopSmall: [1440, 1],
  306. //itemsTablet: [1024, 1],
  307. //itemsTabletSmall: [600, 1],
  308. //itemsMobile: [360, 1],
  309. beforeMove: beforeMove,
  310. afterMove: afterMove,
  311. afterInit: afterInit
  312. });
  313. function beforeMove() {
  314. $('.slider-hero .overlay-hero .caption-hero').fadeOut(1);
  315. }
  316. function afterMove() {
  317. $('.slider-hero .owl-item.active ').find('.caption-hero').delay(500).fadeIn(1500);
  318. BackgroundCheck.refresh();
  319. }
  320. function afterInit() {
  321. $('.slider-hero .owl-item.active ').find('.caption-hero').delay(500).fadeIn(1500);
  322. BackgroundCheck.init({
  323. targets: '.full-intro',
  324. images: '.owl-carousel .item img',
  325. });
  326. }
  327. $(window).height(function () {
  328. heroResize();
  329. function heroResize() {
  330. var windowHeight = $(window).innerHeight();
  331. $('.slider-hero, .full-screen-intro').css('height', windowHeight);
  332. };
  333. $(window).resize(function () {
  334. heroResize();
  335. });
  336. });
  337. };
  338. // ---------------------------------------------------------------------------------------------------------------------------->
  339. // PLUGIN MEDIA FUNCTIONS ||-----------
  340. // ---------------------------------------------------------------------------------------------------------------------------->
  341. function pluginElement() {
  342. // Media Player Elements
  343. videoElement();
  344. function videoElement() {
  345. $('.video').mediaelementplayer({
  346. loop: true,
  347. enableKeyboard: false,
  348. iPadUseNativeControls: false,
  349. pauseOtherPlayers: false,
  350. iPhoneUseNativeControls: false,
  351. AndroidUseNativeControls: false,
  352. enableAutosize: true
  353. });
  354. $('.bg-video').mediaelementplayer({
  355. loop: true,
  356. enableKeyboard: false,
  357. iPadUseNativeControls: false,
  358. pauseOtherPlayers: false,
  359. iPhoneUseNativeControls: false,
  360. AndroidUseNativeControls: false,
  361. enableAutosize: true,
  362. alwaysShowControls: false,
  363. });
  364. $('.audio').mediaelementplayer({
  365. audioWidth: '100%',
  366. pauseOtherPlayers: false,
  367. });
  368. };
  369. };
  370. // ---------------------------------------------------------------------------------------------------------------------------->
  371. // CONTAINER GRID & MESONRY FUNCTIONS (Portfolio, blog, etc) ||-----------
  372. // ---------------------------------------------------------------------------------------------------------------------------->
  373. function containerGridMasonry() {
  374. // Gria Element
  375. // ISOTOPE MASONRY ELEMENT ||--------------
  376. var $container = $('.container-masonry');
  377. $container.imagesLoaded(function () {
  378. $container.isotope({
  379. itemSelector: '.nf-item',
  380. layoutMode: 'masonry',
  381. masonry: {
  382. columnWidth: 0,
  383. gutter: 0
  384. },
  385. });
  386. });
  387. // bind filter button click
  388. $('.container-filter').on('click', '.categories', function () {
  389. var filterValue = $(this).attr('data-filter');
  390. $container.isotope({ filter: filterValue });
  391. });
  392. // ISOTOPE GRID ELEMENT ||--------------
  393. var $container2 = $('.container-grid');
  394. $container2.imagesLoaded(function () {
  395. $container2.isotope({
  396. itemSelector: '.nf-item',
  397. layoutMode: 'fitRows'
  398. });
  399. });
  400. // bind filter categories click
  401. $('.container-filter').on('click', '.categories', function () {
  402. var filterValue = $(this).attr('data-filter');
  403. $container2.isotope({ filter: filterValue });
  404. });
  405. // change active class on categories
  406. $('.categories-filter').each(function (i, buttonGroup) {
  407. var $buttonGroup = $(buttonGroup);
  408. $buttonGroup.on('click', '.categories', function () {
  409. $buttonGroup.find('.active').removeClass('active');
  410. $(this).addClass('active');
  411. });
  412. });
  413. // Masonry Element
  414. var container = $('.masonry');
  415. container.masonry({
  416. // columnWidth: 0,
  417. itemSelector: '.nf-item'
  418. });
  419. };
  420. // ---------------------------------------------------------------------------------------------------------------------------->
  421. // SCROLL CALLBACK FUNCTION ||-----------
  422. // ---------------------------------------------------------------------------------------------------------------------------->
  423. function scrollCallbackEle() {
  424. //scroll Callback Element
  425. $('.load-ele-fade').viewportChecker({
  426. classToAdd: 'visible animated fadeIn',
  427. offset: 100,
  428. callbackFunction: function (elem, action) {
  429. }
  430. });
  431. };
  432. // ---------------------------------------------------------------------------------------------------------------------------->
  433. // SHORTCODE ELEMENTS ||-----------
  434. // ---------------------------------------------------------------------------------------------------------------------------->
  435. shortcodeElements();
  436. function shortcodeElements() {
  437. // Search Overlay Menu
  438. $('.search-overlay-menu-btn').on('click', function (eventSearch) {
  439. $('.search-overlay-menu').addClass('open');
  440. $('.search-overlay-menu > form > input[type="search"]').focus();
  441. });
  442. $('.search-overlay-close').on('click', function (eventSearch) {
  443. $('.search-overlay-menu').removeClass('open');
  444. });
  445. $('.search-overlay-menu, .search-overlay-menu .search-overlay-close').on('click keyup', function (eventSearch) {
  446. if (eventSearch.target == this || eventSearch.target.className == 'search-overlay-close' || eventSearch.keyCode == 27) {
  447. $(this).removeClass('open');
  448. }
  449. });
  450. // Portfolio Lightbox Popup Elements
  451. lightbox();
  452. function lightbox() {
  453. $(".cbox-gallary1").colorbox({
  454. rel: 'gallary',
  455. maxWidth: "95%",
  456. maxHeight: "95%"
  457. });
  458. $(".cbox-iframe").colorbox({
  459. iframe: true,
  460. maxWidth: "95%",
  461. maxHeight: "95%",
  462. innerWidth: 640,
  463. innerHeight: 390
  464. });
  465. };
  466. // Skills Progressbar Elements
  467. skillsProgressBar();
  468. function skillsProgressBar() {
  469. $('.skillbar').each(function () {
  470. $(this).find('.skillbar-bar').animate({
  471. width: $(this).attr('data-percent')
  472. }, 2000);
  473. });
  474. };
  475. // Tooltip
  476. $(".tipped").tipper();
  477. //Counter
  478. $('.counter').each(function () {
  479. var $this = $(this),
  480. countTo = $this.attr('data-count');
  481. $({ countNum: $this.text() }).animate({
  482. countNum: countTo
  483. },
  484. {
  485. duration: 8000,
  486. easing: 'linear',
  487. step: function () {
  488. $this.text(Math.floor(this.countNum));
  489. },
  490. complete: function () {
  491. $this.text(this.countNum);
  492. //alert('finished');
  493. }
  494. });
  495. });
  496. };
  497. // Accordion Function Elements
  498. accordion();
  499. function accordion() {
  500. $('.accordion-title').click(function (e) {
  501. $(this).next().slideToggle('easeOut');
  502. $(this).toggleClass('active');
  503. $("accordion-title").toggleClass('active');
  504. $(".accordion-content").not($(this).next()).slideUp('easeIn');
  505. $(".accordion-title").not($(this)).removeClass('active');
  506. });
  507. $(".accordion-content").addClass("defualt-hidden");
  508. };
  509. // Jquery UI Elements
  510. jqueryUi();
  511. function jqueryUi() {
  512. // Tab Function
  513. $(function () {
  514. $(".tabs").tabs();
  515. });
  516. // Price Filter Slider
  517. $(function () {
  518. $("#range-slider").slider({
  519. range: true,
  520. min: 0,
  521. max: 500,
  522. values: [0, 300],
  523. slide: function (event, ui) {
  524. $(".price-amount-from").text("$" + ui.values[0]);
  525. $(".price-amount-to").text("$" + ui.values[1]);
  526. }
  527. });
  528. $(".price-amount-from").text("$" + $("#range-slider").slider("values", 0));
  529. $(".price-amount-to").text("$" + $("#range-slider").slider("values", 1));
  530. });
  531. };
  532. });