$(document).ready(function() { // the body of this function is in assets/js/now-ui-kit.js // nowuiKit.initSliders(); $('.navbar-brand, .nav-link, .copyright a, .footer a').click(function(e) { $.scrollTo( this.hash || 0, 800); e.preventDefault(); }); $('.send-button .btn').on('click', formSend); $('.nav-link').on('click', function(){ $('#bodyClick').click(); }); }); /* function scrollToDownload() { if ($('.section-download').length != 0) { $("html, body").animate({ scrollTop: $('.section-download').offset().top }, 1000); } } /* global blueimp, $ */ $(function () { 'use strict' $.ajax({ url: '//' + document.domain + '/ajax/gallery/', data: { format: 'json', method: 'getList', list_id: '1' // jshint ignore:line }, dataType: 'jsonp', jsonp: 'jsoncallback' }).done(function (response) { var carouselLinks = [] var linksContainer = $('#links') var baseUrl $.each(response.photos.photo, function (index, photo) { baseUrl = '//' + document.domain + '/img/gallery/' + photo.album + '/' + photo.filename $('') .append($('').prop('src', baseUrl + '_s.jpg')) .prop('href', baseUrl + '_b.jpg') .prop('title', photo.title) .attr('data-gallery', '') .appendTo(linksContainer) carouselLinks.push({ href: baseUrl + '_c.jpg', title: photo.title }) }) // Initialize the Gallery as image carousel: blueimp.Gallery(carouselLinks, { container: '#blueimp-image-carousel', carousel: true }) }) }) /** * browser fix */ var matched, browser; jQuery.uaMatch = function( ua ) { ua = ua.toLowerCase(); var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || /(webkit)[ \/]([\w.]+)/.exec( ua ) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || /(msie) ([\w.]+)/.exec( ua ) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || []; return { browser: match[ 1 ] || "", version: match[ 2 ] || "0" }; }; matched = jQuery.uaMatch( navigator.userAgent ); browser = {}; if ( matched.browser ) { browser[ matched.browser ] = true; browser.version = matched.version; } // Chrome is Webkit, but Webkit is also Safari. if ( browser.chrome ) { browser.webkit = true; } else if ( browser.webkit ) { browser.safari = true; } jQuery.browser = browser; /** * form */ function formSend() { var name = $('#form_name').val(); var phone = $('#form_phone').val(); if(!phoneCheck(phone)) { miniModal('Укажите корректный номер телефона'); return; } $.ajax( { url: '//' + document.domain + '/ajax/order/', data: { format: 'json', name: name, phone: phone }, dataType: 'jsonp', jsonp: 'jsoncallback' }).done(function (response) { miniModal(response.message); $('.send-button .btn').off(); }) } function phoneCheck(phone) { // var re = /^[+]*\d[\d\(\)\ -]{4,14}\d$/; var re = /^[+]*\d[\d\ -]{10}\d$/; var valid = re.test(phone); if(valid) return true; else return false; } function emailCheck(email) { var re = /^[\w-\.]+@[\w-]+\.[a-z]{2,4}$/i; var valid = re.test(email); if(valid) return true; else return false; } function miniModal(message) { $('#mini-modal-message').html(message); $('#myModal1').modal('show'); }