PageRenderTime 51ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/js/main.js

https://gitlab.com/Toye4eva01/phone
JavaScript | 396 lines | 264 code | 86 blank | 46 comment | 16 complexity | 6a135d11204547faed805a2d8200445d MD5 | raw file
  1. /*----------------------------- Parallax --------------------------*/
  2. (function($) {
  3. "use strict";
  4. //Parallax
  5. $(window).bind('load', function () {
  6. parallaxInit();
  7. });
  8. function parallaxInit() {
  9. $('#home').parallax("30%", 0.1);
  10. $('#saparator1').parallax("30%", 0.1);
  11. $('#saparator1').parallax("30%", 0.1);
  12. $('#saparator2').parallax("30%", 0.1);
  13. $('#saparator3').parallax("30%", 0.1);
  14. $('#saparator4').parallax("30%", 0.1);
  15. $('#saparator5').parallax("30%", 0.1);
  16. }
  17. })(jQuery);
  18. (function($) {
  19. "use strict";
  20. /*----------------------------- Fullscreen Slider --------------------------*/
  21. $('#fullscreen-slider').superslides({
  22. animation: 'slide',
  23. pagination: 'false',
  24. play: 8000
  25. });
  26. //SliderCaptions
  27. function metroSlideconfig(){
  28. $('.slider-captions').each(function(){
  29. var windowHeight = ($(window).height()/2),
  30. windowWidth = ($(window).width()/2),
  31. captionHeight = ($('.slider-captions').height()/2),
  32. captionWidth = ($('.slider-captions').width()/2);
  33. $('#fullscreen-slider').css({'height': (windowHeight * 2 ) + 'px' });
  34. $('#fullscreen-slider li').css({'width': $(window).width() + 'px' });
  35. });
  36. };
  37. metroSlideconfig()
  38. jQuery(window).resize(metroSlideconfig);
  39. /*----------------------------- Home Video --------------------------*/
  40. $('.video-h').magnificPopup({
  41. type: 'iframe',
  42. iframe: {
  43. markup: '<div class="mfp-iframe-scaler">'+
  44. '<div class="mfp-close"></div>'+
  45. '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+
  46. '</div>', // HTML markup of popup, `mfp-close` will be replaced by the close button
  47. patterns: {
  48. youtube: {
  49. index: 'youtube.com/', // String that detects type of video (in this case YouTube). Simply via url.indexOf(index).
  50. id: 'v=', // String that splits URL in a two parts, second part should be %id%
  51. // Or null - full URL will be returned
  52. // Or a function that should return %id%, for example:
  53. // id: function(url) { return 'parsed id'; }
  54. src: 'http://www.youtube.com/embed/%id%?autoplay=1' // URL that will be set as a source for iframe.
  55. },
  56. vimeo: {
  57. index: 'vimeo.com/',
  58. id: '/',
  59. src: 'http://player.vimeo.com/video/%id%?autoplay=1'
  60. },
  61. gmaps: {
  62. index: '//maps.google.',
  63. src: '%id%&output=embed'
  64. }
  65. },
  66. }
  67. });
  68. })(jQuery);
  69. /*----------------------------- Navigation --------------------------*/
  70. (function($) {
  71. "use strict";
  72. //OnePage Navigation
  73. $('#nav').onePageNav({
  74. currentClass: 'active',
  75. filter: ':not(.external)',
  76. scrollOffset: 30
  77. });
  78. $('.nav a.colapse-menu1').click(function () { $(".navbar-collapse").collapse("hide") });
  79. $('body').on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); });
  80. jQuery(window).on('scroll', function (){
  81. if ($(this).scrollTop() > 700){
  82. $('#main-menu').addClass('is-sticky');
  83. } else {
  84. $('#main-menu').removeClass('is-sticky');
  85. }
  86. });
  87. //Smoothscroll
  88. smoothScroll.init({
  89. speed: 200
  90. });
  91. //Responsive Nav
  92. $( "ul.sub-menu").parent().append("<span class='toggle_nav_button'>+</span>");
  93. $(".toggle_nav_button").click(
  94. function(){
  95. var link = $(this);
  96. $(this).parent().find("ul.sub-menu").slideToggle('fast', function(){
  97. if ($(this).is(':visible')){
  98. link.text('-');
  99. } else {
  100. link.text('+');
  101. }
  102. });
  103. return false;
  104. });
  105. })(jQuery);
  106. (function($) {
  107. "use strict";
  108. /*----------------------------- Popup --------------------------*/
  109. $('.popup-link').magnificPopup({
  110. type:'image',
  111. removalDelay: 300,
  112. // Class that is added to popup wrapper and background
  113. mainClass: 'mfp-fade'
  114. });
  115. /*----------------------------- Accordions --------------------------*/
  116. $('.accordion dt').click(function() {
  117. // make the accordion close on the second click
  118. if ($('.accordion dd').hasClass('openDiv')) {
  119. $('.accordion dd').slideUp('normal');
  120. $(this).next().removeClass('openDiv');
  121. }
  122. else {
  123. $('.accordion dd').slideUp('normal');
  124. $(this).next().slideDown('normal');
  125. $(this).next().addClass('openDiv');
  126. }
  127. return false;
  128. });
  129. /*----------------------------- Counter --------------------------*/
  130. $(".timer").appear(function() {
  131. var counter = $(this).html();
  132. $(this).countTo({
  133. from: 0,
  134. to: counter,
  135. speed: 2000,
  136. refreshInterval: 60,
  137. });
  138. });
  139. /*----------------------------- About Slider --------------------------*/
  140. $('#about-slider').owlCarousel({
  141. singleItem: true,
  142. navigation : true,
  143. slideSpeed : 1000,
  144. stopOnHover: true,
  145. pagination : false,
  146. navigationText : ['<i class="fa fa-angle-left about-slider-arrow"></i>','<i class="fa fa-angle-right about-slider-arrow"></i>'], // <=== Custom Navigation buttons
  147. mouseDrag: false,
  148. autoPlay: 3000
  149. });
  150. /*----------------------------- Blog post slider --------------------------*/
  151. $("#blog-carousel").owlCarousel({
  152. autoPlay: 3000,
  153. navigation : false, // Show next and prev buttons
  154. slideSpeed : 300,
  155. paginationSpeed : 400,
  156. pagination : false,
  157. singleItem:true
  158. // "singleItem:true" is a shortcut for:
  159. // items : 1,
  160. // itemsDesktop : false,
  161. // itemsDesktopSmall : false,
  162. // itemsTablet: false,
  163. // itemsMobile : false
  164. });
  165. /*----------------------------- Team Slider --------------------------*/
  166. $('#team-slider').owlCarousel({
  167. items : 4,
  168. itemsDesktop : [1199,3],
  169. itemsDesktopSmall : [979,3],
  170. navigation : true,
  171. slideSpeed : 1000,
  172. pagination : false,
  173. navigationText : ["",""],
  174. mouseDrag: false,
  175. autoPlay: 4000
  176. });
  177. /*----------------------------- Testimonials Slider --------------------------*/
  178. $("#testimonials").owlCarousel({
  179. autoPlay: 3000, //Set AutoPlay to 3 seconds
  180. items : 2,
  181. itemsDesktop : [1199,2],
  182. pagination : false,
  183. itemsDesktopSmall : [979,1]
  184. // "singleItem:true" is a shortcut for:
  185. // items : 1,
  186. // itemsDesktop : false,
  187. // itemsDesktopSmall : false,
  188. // itemsTablet: false,
  189. // itemsMobile : false
  190. });
  191. /*----------------------------- Skill Bar --------------------------*/
  192. $(".skillbar").appear(function() {
  193. $('.skillbar').each(function(){
  194. $(this).find('.skillbar-bar').animate({
  195. width:$(this).attr('data-percent')},6000);
  196. });
  197. }, {accX: 0, accY: -170});
  198. /*----------------------------- Google map --------------------------*/
  199. $('#map').gmap3({
  200. marker:{address:"Haltern am See, Weseler Str. 151", options:{icon: "img/location1.png"}},
  201. map:{
  202. options:{
  203. zoom: 14,
  204. scrollwheel: false
  205. }
  206. }
  207. });
  208. /*----------------------------- Contact Form --------------------------*/
  209. $('#submit').formValidator({
  210. scope: '#form'
  211. });
  212. $('#post-commentsss').formValidator({
  213. scope: '#comments-form'
  214. });
  215. $('#submit,#post-commentsss').click(function() {
  216. $('input.error-input, textarea.error-input').delay(300).animate({marginLeft:0},100).animate({marginLeft:10},100).animate({marginLeft:0},100).animate({marginLeft:10},100);
  217. });
  218. // Form plugin
  219. var options = {
  220. beforeSubmit: function() {
  221. $('.sending').show();
  222. },
  223. success: function() {
  224. $('.sending').hide();
  225. $('#form').hide();
  226. $(".mess").show().html('<h5>Thanks !</h5><h5>Your message has been sent.</h5>'); // Change Your message post send
  227. $('.mess').delay(3000).fadeOut(function() {
  228. $('#form').clearForm();
  229. $('#form').delay(3500).show();
  230. });
  231. }
  232. };
  233. $('#form').submit(function() {
  234. $(this).ajaxSubmit(options);
  235. return false;
  236. });
  237. })(jQuery);
  238. /*----------------------------- Portfolio --------------------------*/
  239. jQuery(document).ready(function($) {
  240. "use strict";
  241. $(window).load(function() {
  242. //Preloader
  243. $(".mask").delay(500).fadeOut("slow");
  244. $(function(){
  245. var $container = $('.portfolio-container');
  246. $container.isotope({
  247. itemSelector : '.mt',
  248. layoutMode : 'masonry'
  249. });
  250. var $optionSets = $('#options .option-set'),
  251. $optionLinks = $optionSets.find('a');
  252. $optionLinks.click(function(){
  253. var $this = $(this);
  254. // don't proceed if already selected
  255. if ( $this.hasClass('selected') ) {
  256. return false;
  257. }
  258. var $optionSet = $this.parents('.option-set');
  259. $optionSet.find('.selected').removeClass('selected');
  260. $this.addClass('selected');
  261. // make option object dynamically, i.e. { filter: '.my-filter-class' }
  262. var options = {},
  263. key = $optionSet.attr('data-option-key'),
  264. value = $this.attr('data-option-value');
  265. // parse 'false' as false boolean
  266. value = value === 'false' ? false : value;
  267. options[ key ] = value;
  268. if ( key === 'layoutMode' && typeof changeLayoutMode === 'function' ) {
  269. // changes in layout modes need extra logic
  270. changeLayoutMode( $this, options )
  271. } else {
  272. // otherwise, apply new options
  273. $container.isotope( options );
  274. }
  275. return false;
  276. });
  277. });
  278. /*----------------------------- Blog Post masonry --------------------------*/
  279. var $container = $('.blog-post-holder');
  280. $container.isotope({
  281. masonry: {
  282. },
  283. animationOptions: {
  284. duration: 750,
  285. easing: 'linear',
  286. queue: false,
  287. },
  288. });
  289. });
  290. /*----------------------------- Animation on scroll --------------------------*/
  291. var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
  292. if (isMobile == false) {
  293. $("[data-animation]").each(function() {
  294. var $this = $(this);
  295. $this.addClass("animation");
  296. if(!$("html").hasClass("no-csstransitions") && $(window).width() > 767) {
  297. $this.appear(function() {
  298. var delay = ($this.attr("data-animation-delay") ? $this.attr("data-animation-delay") : 1);
  299. if(delay > 1) $this.css("animation-delay", delay + "ms");
  300. $this.addClass($this.attr("data-animation"));
  301. setTimeout(function() {
  302. $this.addClass("animation-visible");
  303. }, delay);
  304. }, {accX: 0, accY: -170});
  305. } else {
  306. $this.addClass("animation-visible");
  307. }
  308. });
  309. }
  310. });