custom.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950
  1. $(window).load(function() {
  2. $("#status").fadeOut(); // will first fade out the loading animation
  3. $("#preloader").delay(100).fadeOut("slow"); // will fade out the white DIV that covers the website.
  4. });
  5. $( document ).ready(function() {
  6. $('.header-menu').click(function(){
  7. $('.navigation').toggleClass('show-menu');
  8. $(this).find('.fa').toggleClass('rotate-star');
  9. return false;
  10. });
  11. $('.close-header-menu').click(function(){
  12. $('.navigation').toggleClass('show-menu');
  13. $(this).parent().parent().find('.fa').removeClass('rotate-star');
  14. return false;
  15. });
  16. /*Cookie Notification*/
  17. if (typeof window.sessionStorage != undefined) {
  18. if (!sessionStorage.getItem('enabled_cookie')) {
  19. $('.tutorial').show();
  20. sessionStorage.setItem('enabled_cookie', true);
  21. sessionStorage.setItem('storedWhen', (new Date()).getTime());
  22. }
  23. }
  24. $('.tutorial').click(function(){
  25. $(this).fadeOut(500);
  26. });
  27. /*Image Sliders*/
  28. //Note. Every image slider must be placed within the timeout function.//
  29. //Image sliders put a lot of load on mobile devices and slow the performance of other animations//
  30. //But adding a timeout event, even for a microsecond gives a great boost in performance (41% boost to be exact)
  31. setTimeout(function() {
  32. //Simple Slider
  33. var owl = $('.simple-slider');
  34. owl.owlCarousel({
  35. animateOut: 'fadeOut',
  36. animateIn: 'fadeIn',
  37. items:1,
  38. loop:true,
  39. margin:5,
  40. autoplay:true,
  41. autoplayTimeout:3000,
  42. autoplayHoverPause:true
  43. });
  44. //Coverpage Slider
  45. $('.coverpage-slider').owlCarousel({
  46. loop:true,
  47. margin:-2,
  48. nav:false,
  49. dots:true,
  50. items:1
  51. });
  52. //Demo Slider inside Quotes
  53. $('.demo-slider').owlCarousel({
  54. loop:true,
  55. margin:200,
  56. nav:false,
  57. autoHeight:true,
  58. responsive:{
  59. 0:{
  60. items:1
  61. },
  62. 600:{
  63. items:2
  64. }
  65. }
  66. });
  67. $('.next-demo').click(function() {$('.demo-slider').trigger('next.owl.carousel'); return false;});
  68. $('.prev-demo').click(function() {$('.demo-slider').trigger('prev.owl.carousel'); return false;});
  69. //Homepage Slider No Transitions
  70. $('.homepage-slider-no-transition').owlCarousel({
  71. autoplay:true,
  72. autoplayTimeout:5000,
  73. autoplayHoverPause:true,
  74. loop:true,
  75. margin:10,
  76. nav:false,
  77. dots:false,
  78. items:1
  79. });
  80. //Homepage Slider With Transition
  81. $('.homepage-slider-transition').owlCarousel({
  82. autoplay:true,
  83. autoplayTimeout:5000,
  84. autoplayHoverPause:true,
  85. animateOut: 'fadeOut',
  86. animateIn: 'fadein',
  87. loop:true,
  88. margin:10,
  89. nav:false,
  90. dots:false,
  91. items:1
  92. });
  93. //Homepage Slider With Transition 2
  94. $('.homepage-slider-transition-2').owlCarousel({
  95. autoplay:true,
  96. autoplayTimeout:5000,
  97. autoplayHoverPause:true,
  98. animateOut: 'slideOutDown',
  99. animateIn: 'slideInUp',
  100. loop:true,
  101. margin:10,
  102. nav:false,
  103. dots:false,
  104. items:1
  105. });
  106. //Homepage Slider With Transition 2
  107. $('.homepage-slider-transition-3').owlCarousel({
  108. autoplay:true,
  109. autoplayTimeout:5000,
  110. autoplayHoverPause:true,
  111. animateOut: 'rollOut',
  112. animateIn: 'rollIn',
  113. loop:true,
  114. margin:10,
  115. nav:false,
  116. dots:false,
  117. items:1
  118. });
  119. $('.homepage-cover-slider').owlCarousel({
  120. autoplay:true,
  121. autoplayTimeout:5000,
  122. autoplayHoverPause:true,
  123. animateOut: 'fadeOut',
  124. animateIn: 'fadeIn',
  125. loop:true,
  126. margin:10,
  127. nav:false,
  128. dots:false,
  129. items:1
  130. });
  131. $('.next-home-slider').click(function() {$('.homepage-slider-transition, .homepage-slider-transition-2, .homepage-slider-transition-3, .homepage-slider-no-transition').trigger('next.owl.carousel'); return false;});
  132. $('.prev-home-slider').click(function() {$('.homepage-slider-transition, .homepage-slider-transition-2, .homepage-slider-transition-3, .homepage-slider-no-transition').trigger('prev.owl.carousel'); return false;});
  133. //Staff Slider No Transition
  134. $('.staff-slider-no-transition').owlCarousel({
  135. autoplay:true,
  136. autoplayTimeout:5000,
  137. autoplayHoverPause:true,
  138. lazyLoad:true,
  139. loop:true,
  140. margin:10,
  141. nav:false,
  142. dots:false,
  143. responsive:{
  144. 0:{
  145. items:1
  146. },
  147. 600:{
  148. items:2
  149. },
  150. 1000:{
  151. items:3
  152. }
  153. }
  154. });
  155. //Staff Slider With Transition
  156. $('.staff-slider-transition').owlCarousel({
  157. autoplay:true,
  158. autoplayTimeout:5000,
  159. autoplayHoverPause:true,
  160. animateOut: 'fadeOut',
  161. animateIn: 'fadeIn',
  162. lazyLoad:true,
  163. loop:true,
  164. margin:10,
  165. nav:false,
  166. dots:false,
  167. responsive:{
  168. 0:{
  169. items:1
  170. },
  171. 600:{
  172. items:2
  173. },
  174. 1000:{
  175. items:3
  176. }
  177. }
  178. });
  179. $('.next-staff-slider').click(function() {$('.staff-slider-no-transition, .staff-slider-transition').trigger('next.owl.carousel'); return false;});
  180. $('.prev-staff-slider').click(function() {$('.staff-slider-no-transition, .staff-slider-transition').trigger('prev.owl.carousel'); return false;});
  181. //Quote Slider No Transition
  182. $('.quote-slider-no-transition').owlCarousel({
  183. autoHeight:true,
  184. autoplay:true,
  185. autoplayTimeout:5000,
  186. autoplayHoverPause:true,
  187. lazyLoad:true,
  188. loop:true,
  189. margin:10,
  190. nav:false,
  191. dots:false,
  192. responsive:{
  193. 0:{
  194. items:1
  195. },
  196. 600:{
  197. items:1
  198. },
  199. 1000:{
  200. items:1
  201. }
  202. }
  203. });
  204. //Quote Slider No Transition
  205. $('.quote-slider-transition').owlCarousel({
  206. autoHeight:true,
  207. autoplay:true,
  208. autoplayTimeout:5000,
  209. autoplayHoverPause:true,
  210. animateOut: 'fadeOut',
  211. animateIn: 'fadeIn',
  212. lazyLoad:true,
  213. loop:true,
  214. margin:10,
  215. nav:false,
  216. dots:false,
  217. responsive:{
  218. 0:{
  219. items:1
  220. },
  221. 600:{
  222. items:1
  223. },
  224. 1000:{
  225. items:1
  226. }
  227. }
  228. });
  229. $('.next-quote-slider').click(function() {$('.quote-slider-no-transition, .quote-slider-transition').trigger('next.owl.carousel'); return false;});
  230. $('.prev-quote-slider').click(function() {$('.quote-slider-no-transition, .quote-slider-transition').trigger('prev.owl.carousel'); return false;});
  231. //Placing the Dots if Needed
  232. function slider_dots(){
  233. var dots_width = (-($('.owl-dots').width()/2));
  234. $('.owl-dots').css('position', 'absolute');
  235. $('.owl-dots').css('left', '50%');
  236. $('.owl-dots').css('margin-left', dots_width);
  237. }
  238. slider_dots();
  239. }, 1);
  240. //Detect if iOS WebApp Engaged and permit navigation without deploying Safari
  241. (function(a,b,c){if(c in b&&b[c]){var d,e=a.location,f=/^(a|html)$/i;a.addEventListener("click",function(a){d=a.target;while(!f.test(d.nodeName))d=d.parentNode;"href"in d&&(d.href.indexOf("http")||~d.href.indexOf(e.host))&&(a.preventDefault(),e.href=d.href)},!1)}})(document,window.navigator,"standalone")
  242. //Fast Click - Removing 300ms delay when clicking for instant response time
  243. $(function() {
  244. FastClick.attach(document.body);
  245. });
  246. //Lazy Load | Preloading Image
  247. $(function() {
  248. $(".preload-image").lazyload({
  249. threshold : 200,
  250. effect : "fadeIn"
  251. });
  252. $("img.lazy").show().lazyload();
  253. });
  254. //Page Chapters Activation
  255. $('.show-page-chapters, .hide-chapters').click(function(){
  256. $('.page-chapters').toggleClass('page-chapters-active');
  257. });
  258. $('.page-chapters a').click(function(){
  259. $('.page-chapters a').removeClass('active-chapter');
  260. $(this).addClass('active-chapter');
  261. });
  262. //Countdown timer
  263. var endDate = "June 7, 2015 15:03:25";
  264. $(function() {
  265. $('.countdown-class').countdown({
  266. date: "June 7, 2087 15:03:26"
  267. });
  268. });
  269. //Pie Charts
  270. if ($('body').hasClass('has-charts')){
  271. var pieData = [
  272. { value: 25, color: "#c0392b", highlight: "#c0392b", label: "Red" },
  273. { value: 20, color: "#27ae60", highlight: "#27ae60", label: "Green" },
  274. { value: 15, color: "#f39c12", highlight: "#f39c12", label: "Yellow" },
  275. { value: 30, color: "#2980b9", highlight: "#34495e", label: "Dark Blue" }
  276. ];
  277. var barChartData = {
  278. labels : ["One","Two","Three","Four","Five", "Six"],
  279. datasets : [{
  280. fillColor : "rgba(0,0,0,0.1)",
  281. strokeColor : "rgba(0,0,0,0.2)",
  282. highlightFill: "rgba(0,0,0,0.25)",
  283. highlightStroke: "rgba(0,0,0,0.25)",
  284. data : [20,10,40,30,10, 80]
  285. }]
  286. }
  287. window.onload = function(){
  288. var pie_chart_1 = document.getElementById("generate-pie-chart").getContext("2d");
  289. window.pie_chart_1 = new Chart(pie_chart_1).Pie(pieData);
  290. var bar_chart_1 = document.getElementById("generate-bar-chart").getContext("2d");
  291. window.bar_chart_1 = new Chart(bar_chart_1).Bar(barChartData);
  292. };
  293. }
  294. //Tabs
  295. $('ul.tabs li').click(function(){
  296. var tab_id = $(this).attr('data-tab');
  297. $('ul.tabs li').removeClass('active-tab');
  298. $('.tab-content').slideUp(200);
  299. $(this).addClass('active-tab');
  300. $("#"+tab_id).slideToggle(200);
  301. })
  302. //Accordion
  303. $('.accordion').find('.accordion-toggle').click(function(){
  304. //Expand or collapse this panel
  305. $(this).next().slideDown(250);
  306. $('.accordion').find('i').removeClass('rotate-180');
  307. $(this).find('i').addClass('rotate-180');
  308. //Hide the other panels
  309. $(".accordion-content").not($(this).next()).slideUp(200);
  310. });
  311. //Classic Toggles
  312. $('.toggle-title').click(function(){
  313. $(this).parent().find('.toggle-content').slideToggle(200);
  314. $(this).find('i').toggleClass('rotate-toggle');
  315. return false;
  316. });
  317. //Notifications
  318. $('.static-notification-close').click(function(){
  319. $(this).parent().slideUp(200);
  320. return false;
  321. });
  322. $('.tap-dismiss').click(function(){
  323. $(this).slideUp(200);
  324. return false;
  325. });
  326. //Modal Launchers
  327. $('.modal-close').click(function(){return false;});
  328. $('.simple-modal').click(function() {
  329. $('.simple-modal-content').modal();
  330. });
  331. $('.social-login-modal').click(function() {
  332. $('.social-login-modal-content').modal();
  333. });
  334. $('.simple-login-modal').click(function() {
  335. $('.simple-login-modal-content').modal();
  336. });
  337. $('.social-profile-modal').click(function() {
  338. $('.social-profile-modal-content').modal();
  339. });
  340. //Sharebox Settings
  341. $('.show-share-bottom, .show-share-box').click(function(){
  342. $('.share-bottom').toggleClass('active-share-bottom');
  343. $.modal.close()
  344. return false;
  345. });
  346. $('.close-share-bottom').click(function(){
  347. $('.share-bottom').removeClass('active-share-bottom');
  348. return false;
  349. });
  350. //Fixed Notifications
  351. //top
  352. $('.close-top-notification').click(function(){
  353. $('.top-notification').slideUp(200);
  354. return false;
  355. });
  356. $('.show-top-notification-1').click(function(){
  357. $('.top-notification, .bottom-notification, .timeout-notification').slideUp(200);
  358. $('.top-notification-1').slideDown(200);
  359. });
  360. $('.show-top-notification-2').click(function(){
  361. $('.top-notification, .bottom-notification, .timeout-notification').slideUp(200);
  362. $('.top-notification-2').slideDown(200);
  363. });
  364. $('.show-top-notification-3').click(function(){
  365. $('.top-notification, .bottom-notification, .timeout-notification').slideUp(200);
  366. $('.top-notification-3').slideDown(200);
  367. });
  368. //bottom
  369. $('.close-bottom-notification').click(function(){
  370. $('.bottom-notification').slideUp(200);
  371. clearTimeout(notification_timer);
  372. return false;
  373. });
  374. $('.show-bottom-notification-1').click(function(){
  375. $('.top-notification, .bottom-notification, .timeout-notification').slideUp(200);
  376. $('.bottom-notification-1').slideDown(200);
  377. return false;
  378. });
  379. $('.show-bottom-notification-2').click(function(){
  380. $('.top-notification, .bottom-notification, .timeout-notification').slideUp(200);
  381. $('.bottom-notification-2').slideDown(200);
  382. return false;
  383. });
  384. $('.show-bottom-notification-3').click(function(){
  385. $('.top-notification, .bottom-notification, .timeout-notification').slideUp(200);
  386. $('.bottom-notification-3').slideDown(200);
  387. return false;
  388. });
  389. //Timeout
  390. $('.timer-notification').click(function(){
  391. var notification_timer;
  392. notification_timer = setTimeout(function(){ $('.timeout-notification').slideUp(250); },5000);
  393. });
  394. //Switches
  395. $('.switch-1').click(function(){
  396. $(this).toggleClass('switch-1-on');
  397. return false;
  398. });
  399. $('.switch-2').click(function(){
  400. $(this).toggleClass('switch-2-on');
  401. return false;
  402. });
  403. $('.switch-3').click(function(){
  404. $(this).toggleClass('switch-3-on');
  405. return false;
  406. });
  407. $('.switch, .switch-icon').click(function(){
  408. $(this).parent().find('.switch-box-content').slideToggle(200);
  409. $(this).parent().find('.switch-box-subtitle').slideToggle(200);
  410. return false;
  411. });
  412. //Reminders & Checklists & Tasklists
  413. $('.reminder-check-square').click(function(){
  414. $(this).toggleClass('reminder-check-square-selected');
  415. return false;
  416. });
  417. $('.reminder-check-round').click(function(){
  418. $(this).toggleClass('reminder-check-round-selected');
  419. return false;
  420. });
  421. $('.checklist-square').click(function(){
  422. $(this).toggleClass('checklist-square-selected');
  423. return false;
  424. });
  425. $('.checklist-round').click(function(){
  426. $(this).toggleClass('checklist-round-selected');
  427. return false;
  428. });
  429. $('.tasklist-incomplete').click(function(){
  430. $(this).removeClass('tasklist-incomplete');
  431. $(this).addClass('tasklist-completed');
  432. });
  433. $('.tasklist-item').click(function(){
  434. $(this).toggleClass('tasklist-completed');
  435. });
  436. //Activity Item Toggle
  437. $('.activity-item').click(function(){
  438. $(this).find('.activity-item-detail').slideToggle(200);
  439. });
  440. //Detecting Mobiles//
  441. var isMobile = {
  442. Android: function() {
  443. return navigator.userAgent.match(/Android/i);
  444. },
  445. BlackBerry: function() {
  446. return navigator.userAgent.match(/BlackBerry/i);
  447. },
  448. iOS: function() {
  449. return navigator.userAgent.match(/iPhone|iPad|iPod/i);
  450. },
  451. Opera: function() {
  452. return navigator.userAgent.match(/Opera Mini/i);
  453. },
  454. Windows: function() {
  455. return navigator.userAgent.match(/IEMobile/i);
  456. },
  457. any: function() {
  458. return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
  459. }
  460. };
  461. if(isMobile.any()) {
  462. //Settings for all mobiles
  463. $('head').append('<link />');
  464. }
  465. if( !isMobile.any() ){
  466. $('.show-blackberry, .show-ios, .show-windows, .show-android').hide(0);
  467. $('show-no-detection').show(0);
  468. $('#content').bind('mousewheel', function(event) {
  469. event.preventDefault();
  470. var scrollTop = this.scrollTop;
  471. this.scrollTop = (scrollTop + ((event.deltaY * event.deltaFactor) * -2));
  472. //console.log(event.deltaY, event.deltaFactor, event.originalEvent.deltaMode, event.originalEvent.wheelDelta);
  473. });
  474. $("#content").css("overflow-y","hidden");
  475. }
  476. if(isMobile.Android()) {
  477. $('.show-android').show(0);
  478. $('.show-blackberry, .show-ios, .show-windows').hide(0);
  479. }
  480. if(isMobile.BlackBerry()) {
  481. $('.show-blackberry').show(0);
  482. $('.show-android, .show-ios, .show-windows').hide(0);
  483. }
  484. if(isMobile.iOS()) {
  485. $('.show-ios').show(0);
  486. $('.show-blackberry, .show-android, .show-windows').hide(0);
  487. }
  488. if(isMobile.Windows()) {
  489. $('.show-windows').show(0);
  490. $('.show-blackberry, .show-ios, .show-android').hide(0);
  491. }
  492. $('.back-to-top-badge, .back-to-top').click(function() {
  493. $('#content').animate({
  494. scrollTop:0
  495. }, 500, 'easeInOutQuad');
  496. return false;
  497. });
  498. //Show Back To Home When Scrolling
  499. $('#content').on('scroll', function () {
  500. var total_scroll_height = $('#content')[0].scrollHeight
  501. var inside_header = ($(this).scrollTop() <= 150);
  502. var passed_header = ($(this).scrollTop() >= 0); //250
  503. var footer_reached = ($(this).scrollTop() >= (total_scroll_height - ($(window).height() +100 )));
  504. if (inside_header == true) {
  505. $('.back-to-top-badge').removeClass('back-to-top-badge-visible');
  506. } else if (passed_header == true) {
  507. $('.back-to-top-badge').addClass('back-to-top-badge-visible');
  508. }
  509. if (footer_reached == true){
  510. $('.back-to-top-badge').removeClass('back-to-top-badge-visible');
  511. }
  512. });
  513. //Make contianer fullscreen//
  514. function create_paddings(){
  515. var no_padding = $(window).width();
  516. function mobile_paddings(){
  517. $('.content').css('padding-left', '20px');
  518. $('.content').css('padding-right', '20px');
  519. $('.container-fullscreen, .image-fullscreen').css('margin-left', '-20px');
  520. $('.container-fullscreen, .image-fullscreen').css('width', no_padding +2);
  521. }
  522. function tablet_paddings(){
  523. $('.content').css('padding-left', '50px');
  524. $('.content').css('padding-right', '50px');
  525. $('.container-fullscreen, .image-fullscreen').css('margin-left', '-50px');
  526. $('.container-fullscreen, .image-fullscreen').css('width', no_padding +2);
  527. }
  528. if($(window).width() < 766){
  529. mobile_paddings()
  530. }
  531. if($(window).width() > 766){
  532. tablet_paddings()
  533. }
  534. }
  535. $(window).resize(function() {
  536. create_paddings();
  537. });
  538. create_paddings();
  539. //Morph Headings
  540. $(".infinite-text").Morphext({
  541. // The [in] animation type. Refer to Animate.css for a list of available animations.
  542. animation: "flipInX",
  543. // An array of phrases to rotate are created based on this separator. Change it if you wish to separate the phrases differently (e.g. So Simple | Very Doge | Much Wow | Such Cool).
  544. separator: "|",
  545. // The delay between the changing of each phrase in milliseconds.
  546. speed: 2000,
  547. complete: function () {
  548. // Called after the entrance animation is executed.
  549. }
  550. });
  551. //Set inputs to today's date by adding class set-day
  552. var set_input_now = new Date();
  553. var set_input_month = (set_input_now.getMonth() + 1);
  554. var set_input_day = set_input_now.getDate();
  555. if(set_input_month < 10)
  556. set_input_month = "0" + set_input_month;
  557. if(set_input_day < 10)
  558. set_input_day = "0" + set_input_day;
  559. var set_input_today = set_input_now.getFullYear() + '-' + set_input_month + '-' + set_input_day;
  560. $('.set-today').val(set_input_today);
  561. //Portfolios and Gallerties
  562. $('.adaptive-one').click(function(){
  563. $('.portfolio-switch').removeClass('active-adaptive');
  564. $(this).addClass('active-adaptive');
  565. $('.portfolio-adaptive').removeClass('portfolio-adaptive-two portfolio-adaptive-three');
  566. $('.portfolio-adaptive').addClass('portfolio-adaptive-one');
  567. return false;
  568. });
  569. $('.adaptive-two').click(function(){
  570. $('.portfolio-switch').removeClass('active-adaptive');
  571. $(this).addClass('active-adaptive');
  572. $('.portfolio-adaptive').removeClass('portfolio-adaptive-one portfolio-adaptive-three');
  573. $('.portfolio-adaptive').addClass('portfolio-adaptive-two');
  574. return false;
  575. });
  576. $('.adaptive-three').click(function(){
  577. $('.portfolio-switch').removeClass('active-adaptive');
  578. $(this).addClass('active-adaptive');
  579. $('.portfolio-adaptive').removeClass('portfolio-adaptive-two portfolio-adaptive-one');
  580. $('.portfolio-adaptive').addClass('portfolio-adaptive-three');
  581. return false;
  582. });
  583. //Wide Portfolio
  584. $('.show-wide-text').click(function(){
  585. $(this).parent().find('.wide-text').slideToggle(200);
  586. return false;
  587. });
  588. $('.portfolio-close').click(function(){
  589. $(this).parent().parent().find('.wide-text').slideToggle(200);
  590. return false;
  591. });
  592. $('.show-gallery, .show-gallery-1, .show-gallery-2, .show-gallery-3, .show-gallery-4, .show-gallery-5, .add-gallery a').swipebox();
  593. function apply_gallery_justification(){
  594. var screen_widths = $(window).width();
  595. if( screen_widths < 768){
  596. $('.gallery-justified').justifiedGallery({
  597. rowHeight : 70,
  598. maxRowHeight : 370,
  599. margins : 5,
  600. fixedHeight:false
  601. });
  602. };
  603. if( screen_widths > 768){
  604. $('.gallery-justified').justifiedGallery({
  605. rowHeight : 150,
  606. maxRowHeight : 370,
  607. margins : 5,
  608. fixedHeight:false
  609. });
  610. };
  611. };
  612. apply_gallery_justification();
  613. //Filterable Gallery
  614. var selectedClass = "";
  615. $(".filter-category").click(function(){
  616. $('.portfolio-filter-categories a').removeClass('selected-filter');
  617. $(this).addClass('selected-filter');
  618. selectedClass = $(this).attr("data-rel");
  619. $(".portfolio-filter-wrapper").show(250);
  620. $(".portfolio-filter-wrapper div").not("."+selectedClass).delay(100).hide(250);
  621. setTimeout(function() {
  622. $("."+selectedClass).show(250);
  623. $(".portfolio-filter-wrapper").show(250);
  624. }, 0);
  625. });
  626. if($('body').hasClass('dual-sidebar')){ dual_sidebar(); }
  627. if($('body').hasClass('left-sidebar')){ left_sidebar(); }
  628. if($('body').hasClass('right-sidebar')){ right_sidebar(); }
  629. if($('body').hasClass('no-sidebar')){ no_sidebar(); }
  630. function dual_sidebar(){
  631. var $div = $('<div />').appendTo('body');
  632. $div.attr('id', 'footer-fixed');
  633. $div.attr('class', 'not-active');
  634. var snapper = new Snap({
  635. element: document.getElementById('content'),
  636. elementMirror: document.getElementById('header'),
  637. elementMirror2: document.getElementById('footer-fixed'),
  638. disable: 'none',
  639. tapToClose: true,
  640. touchToDrag: true,
  641. maxPosition: 266,
  642. minPosition: -266
  643. });
  644. $('.close-sidebar').click(function(){snapper.close(); return false;});
  645. $('.open-left-sidebar').click(function() {
  646. //$(this).toggleClass('remove-sidebar');
  647. if( snapper.state().state=="left" ){
  648. snapper.close();
  649. } else {
  650. snapper.open('left');
  651. }
  652. return false;
  653. });
  654. $('.open-right-sidebar').click(function() {
  655. //$(this).toggleClass('remove-sidebar');
  656. if( snapper.state().state=="right" ){
  657. snapper.close();
  658. } else {
  659. snapper.open('right');
  660. }
  661. return false;
  662. });
  663. snapper.on('open', function(){$('.back-to-top-badge').removeClass('back-to-top-badge-visible');});
  664. };
  665. function left_sidebar(){
  666. var $div = $('<div />').appendTo('body');
  667. $div.attr('id', 'footer-fixed');
  668. $div.attr('class', 'not-active');
  669. var snapper = new Snap({
  670. element: document.getElementById('content'),
  671. elementMirror: document.getElementById('header'),
  672. elementMirror2: document.getElementById('footer-fixed'),
  673. disable: 'right',
  674. tapToClose: true,
  675. touchToDrag: true,
  676. maxPosition: 266,
  677. minPosition: -266
  678. });
  679. $('.close-sidebar').click(function(){snapper.close(); return false;});
  680. $('.open-left-sidebar').click(function() {
  681. //$(this).toggleClass('remove-sidebar');
  682. if( snapper.state().state=="left" ){
  683. snapper.close();
  684. } else {
  685. snapper.open('left');
  686. }
  687. return false;
  688. });
  689. snapper.on('open', function(){$('.back-to-top-badge').removeClass('back-to-top-badge-visible');});
  690. };
  691. function right_sidebar(){
  692. var $div = $('<div />').appendTo('body');
  693. $div.attr('id', 'footer-fixed');
  694. $div.attr('class', 'not-active');
  695. var snapper = new Snap({
  696. element: document.getElementById('content'),
  697. elementMirror: document.getElementById('header'),
  698. elementMirror2: document.getElementById('footer-fixed'),
  699. disable: 'left',
  700. tapToClose: true,
  701. touchToDrag: true,
  702. maxPosition: 266,
  703. minPosition: -266
  704. });
  705. $('.close-sidebar').click(function(){snapper.close(); return false;});
  706. $('.open-right-sidebar').click(function() {
  707. //$(this).toggleClass('remove-sidebar');
  708. if( snapper.state().state=="right" ){
  709. snapper.close();
  710. } else {
  711. snapper.open('right');
  712. }
  713. return false;
  714. });
  715. snapper.on('open', function(){$('.back-to-top-badge').removeClass('back-to-top-badge-visible');});
  716. };
  717. function no_sidebar(){
  718. var snapper = new Snap({
  719. element: document.getElementById('content'),
  720. elementMirror: document.getElementById('header'),
  721. elementMirror2: document.getElementById('footer-fixed'),
  722. disable: 'none',
  723. tapToClose: false,
  724. touchToDrag: false
  725. });
  726. };
  727. //Fullscreen Map
  728. $('.map-text, .map-overlay').click(function(){
  729. $('.map-text, .map-overlay').fadeOut(200);
  730. $('.deactivate-map').fadeIn(200);
  731. });
  732. $('.deactivate-map').click(function(){
  733. $('.map-text, .map-overlay').fadeIn(200);
  734. $('.deactivate-map').fadeOut(200);
  735. });
  736. function generate_map(){
  737. var map_width = $(window).width();
  738. var map_height = $(window).height();
  739. $('.map-fullscreen iframe').css('width', map_width);
  740. $('.map-fullscreen iframe').css('height', map_height);
  741. };
  742. generate_map();
  743. //-------------------Generate Cover Screen Elements--------------------//
  744. //Global Settings for Fullscreen Pages, PageApps and Coverscreen Slider//
  745. function align_cover_elements(){
  746. var cover_width = $(window).width();
  747. var cover_height = $(window).height();
  748. var cover_vertical = -($('.cover-center').height())/2;
  749. var cover_horizontal = -($('.cover-center').width())/2;
  750. $('.cover-screen').css('width', cover_width);
  751. $('.cover-screen').css('height', cover_height);
  752. $('.cover-screen .overlay').css('width', cover_width);
  753. $('.cover-screen .overlay').css('height', cover_height);
  754. $('.cover-center').css('margin-left', cover_horizontal);
  755. $('.cover-center').css('margin-top', cover_vertical + 30);
  756. $('.cover-left').css('margin-top', cover_vertical);
  757. $('.cover-right').css('margin-top', cover_vertical);
  758. $('.homepage-cover, .homepage-cover-slider').css('height', cover_height);
  759. $('.homepage-cover, .homepage-cover-slider').css('width', cover_width);
  760. };
  761. align_cover_elements();
  762. //Resize Functions//
  763. $(window).resize(function(){
  764. apply_gallery_justification();
  765. align_cover_elements();
  766. generate_map();
  767. });
  768. //Swipebox Image Gallery//
  769. //SVG Usage is not recommended due to poor compatibility with older Android / Windows Mobile Devices//
  770. $(".swipebox").swipebox({
  771. useCSS : true,
  772. hideBarsDelay : 3000 // 0 to always show caption and action bar
  773. });
  774. });