Diligent web site
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

custom.js 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. "use strict";
  2. function isOnScreen(elem) {
  3. // if the element doesn't exist, abort
  4. if( elem.length == 0 ) {
  5. return;
  6. }
  7. var $window = jQuery(window)
  8. var viewport_top = $window.scrollTop()
  9. var viewport_height = $window.height()
  10. var viewport_bottom = viewport_top + viewport_height
  11. var $elem = jQuery(elem)
  12. var top = $elem.offset().top
  13. var height = $elem.height()
  14. var bottom = top + height
  15. return (top >= viewport_top && top < viewport_bottom) ||
  16. (bottom > viewport_top && bottom <= viewport_bottom) ||
  17. (height > viewport_height && top <= viewport_top && bottom >= viewport_bottom)
  18. }
  19. // start custom scripts
  20. (function($) {
  21. jQuery(document).ready(function($){
  22. /*========== Swicher ==========*/
  23. /*========== Progress bar ==========*/
  24. function animate() {
  25. $(".progress-bar").each(function(){
  26. var progressValue = $(this).attr('data-value');
  27. $(this).animate({width: progressValue +'%'}, 6000);
  28. });
  29. }
  30. //career
  31. var expand = false;
  32. $('.chev').on('click', function(ev) {
  33. //ev.preventDefault();
  34. $(this).toggleClass('chevron--down chevron--up');
  35. if(!expand)
  36. {
  37. $(this).closest(".position").css({"background-color": "#993c95", "color": "white"});
  38. }
  39. });
  40. //
  41. //contact form
  42. var form = document.getElementById("contact-form");
  43. var button = $("#contact-form #submit");
  44. var status = $(".log");
  45. function success(data){
  46. //form.reset();
  47. //form.css('display', 'block!important');
  48. //button.style = "display: none ";
  49. form.append(xhr.response);
  50. }
  51. function error() {
  52. //status.addClass("error").text("Oops! There was a problem.");
  53. form.append(xhr.response);
  54. }
  55. button.on("submit", function(ev) {
  56. //ev.preventDefault();
  57. //button.style = "display: none ";
  58. var data = new FormData(form);
  59. ajax(form.method, form.action, data, success, error);
  60. // $.ajax({
  61. // url: "https://formspree.io/xnqgkykr",
  62. // method: "POST",
  63. // dataType: "json",
  64. // data: data
  65. // }).then((response) => { success(); });
  66. });
  67. function ajax(method, url, data, success, error) {
  68. var xhr = new XMLHttpRequest();
  69. xhr.open(method, url);
  70. xhr.setRequestHeader("Accept", "application/json");
  71. xhr.onreadystatechange = function() {
  72. if (xhr.readyState !== XMLHttpRequest.DONE) return;
  73. if (xhr.status === 200) {
  74. success();
  75. } else {
  76. error();
  77. }
  78. };
  79. xhr.send(data);
  80. }
  81. //end contact form
  82. // $('#contact-wrap').waypoint(function() {
  83. // animate();
  84. // });
  85. //nikola
  86. $('.clear_storage').on('click', function(e){
  87. window.localStorage.clear();
  88. });
  89. var get_id = localStorage.getItem('pg_id');
  90. // check page id, then scroll to its div
  91. if(get_id)
  92. scrollToID(null, get_id, 300);
  93. // click event to scroll to div
  94. //section link in nav which refer to section on homepage
  95. $('.home_link').on('click', function(e){
  96. e.preventDefault();
  97. var id = '#'+$(this).data('id');
  98. localStorage.setItem('pg_id', id);
  99. var url = $(this).attr("href");
  100. scrollToID(url, id, 300);
  101. });
  102. //Link from our partners section on homepage which refer to section on portfolio page
  103. $('.partners_link').on('click', function(e){
  104. e.preventDefault();
  105. var id = '#'+$(this).data('id');
  106. localStorage.setItem('pg_id', id);
  107. var url = $(this).attr("href");
  108. scrollToID(url, id, 300);
  109. });
  110. function scrollToID(url, id, speed) {
  111. if(url!==null)
  112. {
  113. window.location.href = url;
  114. }
  115. var offSet = 50;
  116. var obj = $(id).offset();
  117. var targetOffset = $(id).offset().top - offSet;
  118. $('html,body').animate({ scrollTop: targetOffset }, speed);
  119. }
  120. window.addEventListener('scroll', function(e) {
  121. var loc = window.location;
  122. if(loc.pathname.substring(loc.pathname.lastIndexOf('/') + 1, loc.pathname.length)=='index.html')
  123. {
  124. if( isOnScreen( $( '#intro-wrap' ) ) ) { /* Pass element id/class you want to check */
  125. $("nav li.active").removeClass("active").find('.nav-active-mark').remove();
  126. $("nav li.intro-wrap").addClass("active").append('<span class="nav-active-mark"></span>');
  127. }
  128. if( isOnScreen( $( '#about-wrap' ) ) ) { /* Pass element id/class you want to check */
  129. $("nav li.active").removeClass("active").find('.nav-active-mark').remove();
  130. $("nav li.about-wrap").addClass("active").append('<span class="nav-active-mark"></span>');
  131. }
  132. if( isOnScreen( $( '#our_partners-wrap' ) ) ) { /* Pass element id/class you want to check */
  133. $("nav li.active").removeClass("active").find('.nav-active-mark').remove();
  134. $("nav li.our_partners-wrap").addClass("active").append('<span class="nav-active-mark"></span>');
  135. }
  136. if( isOnScreen( $( '#services-wrap' ) ) ) { /* Pass element id/class you want to check */
  137. $("nav li.active").removeClass("active").find('.nav-active-mark').remove();
  138. $("nav li.services-wrap").addClass("active").append('<span class="nav-active-mark"></span>');
  139. }
  140. if( isOnScreen( $( '#teams-wrap' ) ) ) { /* Pass element id/class you want to check */
  141. $("nav li.active").removeClass("active").find('.nav-active-mark').remove();
  142. $("nav li.teams-wrap").addClass("active").append('<span class="nav-active-mark"></span>');
  143. }
  144. if( isOnScreen( $( '#contact-wrap' ) ) ) { /* Pass element id/class you want to check */
  145. $("nav li.active").removeClass("active").find('.nav-active-mark').remove();
  146. $("nav li.contact-wrap").addClass("active").append('<span class="nav-active-mark"></span>');
  147. }
  148. }
  149. });
  150. //nikola
  151. /*========== Disables ==========*/
  152. if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) {
  153. $('#animate_css_file, #wow_js_file').remove();
  154. } else {
  155. /*========== WOW Animations ==========*/
  156. var wow = new WOW(
  157. {
  158. animateClass: 'animated',
  159. offset: 100
  160. }
  161. );
  162. wow.init();
  163. }
  164. /*========== Logo Retina ==========*/
  165. if( window.devicePixelRatio > 1 ) {
  166. var logoWidth = $('#logo img').width();
  167. var logoHeight = $('#logo img').height();
  168. $('#logo img').attr("src", "images/logo@2x.png");
  169. $('#logo img').css({ 'width': logoWidth , 'height': logoHeight });
  170. }
  171. /*========== Team Item Hover ==========*/
  172. $('.team-item').each(function(){
  173. var memberImage = $(this).find('.member-face').attr('style');
  174. var current = $(this).find('.change-color');
  175. $(this).find('.hex-in2.outer-hex').first().hover(function(){
  176. $(this).find('.member-face').css('background','#000');
  177. $(current).css('background-color','#f3b202');
  178. $(this).find('.socials').show();
  179. },function(){
  180. $(this).find('.socials').hide();
  181. $(this).find('.member-face').attr('style', memberImage);
  182. $(current).css('background-color','#000');
  183. });
  184. });
  185. /*========== Gallery Item Hover ==========*/
  186. $('.gallery-item').hover(function(){
  187. $(this).find('.gallery-info').stop(true,true).animate({ "top": "0" } );
  188. },function(){
  189. $(this).find('.gallery-info').stop(true,true).animate({ "top": "-999" } );
  190. });
  191. /*========== FlexSlider ==========*/
  192. $('.flexslider').flexslider({
  193. animation: "fade",
  194. animationLoop: false,
  195. directionNav: false,
  196. slideshow: false
  197. });
  198. /*========== Pie Chart ==========*/
  199. $('.days').waypoint(function() {
  200. $('.chart').easyPieChart({
  201. easing: 'easeOutBounce',
  202. barColor: '#f3b202',
  203. trackColor: '#595959',
  204. lineWidth: '18',
  205. lineCap: 'butt',
  206. size: '160',
  207. scaleColor: false,
  208. onStep: function(from, to, percent) {
  209. $(this.el).find('.percent').text(Math.round(percent));
  210. }
  211. });
  212. });
  213. /*========== Smooth Scroll ==========*/
  214. $('a[href*=#]:not([href=#])').click(function() {
  215. $("li.active").removeClass("active").find('.nav-active-mark').remove();
  216. $(this).parent().addClass('active').end().append('<span class="nav-active-mark"></span>');
  217. if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
  218. var target = $(this.hash);
  219. target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
  220. if (target.length) {
  221. $('html,body').animate({
  222. scrollTop: target.offset().top - 53
  223. }, 1000);
  224. return false;
  225. }
  226. }
  227. });
  228. /*========== Graph Bars Animate ==========*/
  229. $('.days').waypoint(function() {
  230. $('.graph ul li.bar').each(function() {
  231. var curBarHeight = $(this).data('bar-height');
  232. $(this).animate({ height: curBarHeight }, 2000, "easeInOutBack");
  233. });
  234. });
  235. /*========== Intro Note Box Tooltip ==========*/
  236. /*$('.note-1').hover(function(){
  237. $(this).find('.note-tooltip').fadeIn();
  238. },function(){
  239. $(this).find('.note-tooltip').fadeOut();
  240. });
  241. */
  242. /*========== PrettyPhoto ==========*/
  243. $("a[data-rel^='prettyPhoto']").prettyPhoto({theme:'dark_rounded', hook: 'data-rel'});
  244. /*========== Flickr ==========*/
  245. var flickrImageSrc = [ ];
  246. var flickrLink = [ ];
  247. $('.flickr_badge_image').each(function(i){
  248. flickrImageSrc[i] = $(this).find('img').attr('src');
  249. flickrLink[i] = $(this).find('a').attr('href');
  250. });
  251. $('.flickr-item').each(function(i){
  252. $(this).find('.hex-area').css('background-image', 'url(' + flickrImageSrc[i] + ')');
  253. $(this).find('.flickr-link').attr('href', flickrLink[i] );
  254. });
  255. /*========== Window Resize ==========*/
  256. var windowWidth = $(window).width();
  257. var numberOfHexagon = windowWidth / 106;
  258. var offsetBackground = ((numberOfHexagon - 14) * 106 ) /2;
  259. $('#hexagon-overlay').css('background-position', offsetBackground + 'px' + ' ' + 'top');
  260. $(window).resize(function() {
  261. var currentWindowWidth = $(window).width();
  262. if(currentWindowWidth <= 940) return;
  263. $('#hexagon-overlay').css('background-position', - ( ( (windowWidth - currentWindowWidth)/2 ) - offsetBackground ) + 'px' + ' ' + 'top');
  264. });
  265. /*========== Mobile Menu ==========*/
  266. $('.mobile-nav-toggle').on('click',function(){
  267. if($(this).attr('class') == 'mobile-nav-toggle deactive') {
  268. $('#mobile-navigation').fadeIn();
  269. $(this).removeClass('deactive');
  270. } else {
  271. $('#mobile-navigation').fadeOut();
  272. $(this).addClass('deactive');
  273. }
  274. });
  275. $("#mobile-navigation li a").on("click", function(){
  276. $('#mobile-navigation').fadeOut();
  277. $(".mobile-nav-toggle").addClass('deactive');
  278. });
  279. $(window).resize(function(){
  280. var w = $(window).width();
  281. if(w > 767) {
  282. $('#mobile-navigation').fadeOut();
  283. $(".mobile-nav-toggle").addClass('deactive');
  284. }
  285. });
  286. /*========== Contact Form Validation ==========*/
  287. function isValidEmailAddress(emailAddress) {
  288. var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
  289. return pattern.test(emailAddress);
  290. }
  291. // $('.contact-form form').submit(function() {
  292. // var hasError = false;
  293. // var comment = $('#message-txt').val();
  294. // if ($.trim(comment) == '') {
  295. // $('#message-txt').addClass('error');
  296. // $('#message-txt').focus();
  297. // hasError = true;
  298. // }
  299. // else {
  300. // $('#message-txt').removeClass('error');
  301. // }
  302. // var subject = $('#subject-txt').val();
  303. // if ($.trim(subject) == '') {
  304. // $('#subject-txt').addClass('error');
  305. // $('#subject-txt').focus();
  306. // hasError = true;
  307. // }
  308. // else {
  309. // $('#subject-txt').removeClass('error');
  310. // }
  311. // var emailVal = $('#email-txt').val();
  312. // if ($.trim(emailVal) == '' || !isValidEmailAddress(emailVal)) {
  313. // $('#email-txt').addClass('error');
  314. // $('#email-txt').focus();
  315. // hasError = true;
  316. // }
  317. // else {
  318. // $('#email-txt').removeClass('error');
  319. // }
  320. // var name = $('#name-txt').val();
  321. // if ($.trim(name) == '') {
  322. // $('#name-txt').addClass('error');
  323. // $('#name-txt').focus();
  324. // hasError = true;
  325. // }
  326. // else {
  327. // $('#name-txt').removeClass('error');
  328. // }
  329. // if (!hasError) {
  330. // $('#submit').fadeOut('normal', function(){
  331. // $('.loading').css({
  332. // display: "block"
  333. // });
  334. // });
  335. // // $.post($('.contact-form form').attr('action'), $('.contact-form form').serialize(), function(data){
  336. // // $('.log').html(data);
  337. // // $('.loading').remove();
  338. // // $('.contact-form form').slideUp('slow');
  339. // // });
  340. // }
  341. // return false;
  342. // });
  343. }); // end jquery init
  344. })(jQuery);