Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bindNav = function() {
- 'use strict';
- var $button, $introContent, $nav;
- $button = $('.nav-button');
- $nav = $('.nav');
- $introContent = $('.intro__content');
- return $button.click(function() {
- $nav.slideToggle();
- return $introContent.toggleClass('intro__content_indent');
- });
- };
- bindCatalog = function() {
- 'use strict';
- var $catalog, $catalogItem, $catalogOpener, $catalogSection, bind, bindCatalogShowing, bindOnClick, bindOnHover, catalogOpenerActiveClass, mobile, openItemClass, unbind;
- $catalog = $('.catalog');
- $catalogItem = $('.catalog__item');
- $catalogOpener = $('.catalog-opener');
- $catalogSection = $('.catalog-section');
- openItemClass = 'catalog__item_open';
- catalogOpenerActiveClass = 'catalog-opener_active';
- mobile = windowWidth <= 992;
- bindCatalogShowing = function() {
- var SPACE, pullLeftClass;
- pullLeftClass = 'catalog_pull-left';
- SPACE = 50;
- $catalogOpener.mouseenter(function() {
- var $container, $currentCatalog, $subcatalog, catalogFullWidth, itemOffset;
- $currentCatalog = $(this).find($catalog);
- $subcatalog = $currentCatalog.find('.subcatalog').first();
- $container = $(this).closest('.catalog-container');
- if ($currentCatalog.length) {
- $(this).addClass(catalogOpenerActiveClass);
- itemOffset = $(this).position().left - $container.position().left;
- catalogFullWidth = itemOffset + ($currentCatalog.width() + $subcatalog.width());
- if ($container.width() - catalogFullWidth - SPACE < 0) {
- return $currentCatalog.addClass(pullLeftClass);
- }
- }
- });
- return $catalogOpener.mouseleave(function() {
- $(this).removeClass(catalogOpenerActiveClass);
- return $catalog.removeClass(pullLeftClass);
- });
- };
- unbind = function() {
- $catalog.unbind();
- $catalogItem.unbind();
- $catalogOpener.unbind();
- $catalogSection.find('a').unbind();
- return $('.' + openItemClass).removeClass(openItemClass);
- };
- bindOnHover = function() {
- bindCatalogShowing();
- $($catalogSection).find('ul').css('display', '');
- return $catalog.menuAim({
- activate: function(item) {
- return $(item).addClass(openItemClass);
- },
- deactivate: function(item) {
- return $(item).removeClass(openItemClass);
- },
- exitMenu: function() {
- return $('.' + openItemClass).removeClass(openItemClass);
- }
- });
- };
- bindOnClick = function() {
- $('.catalog-button').click(function() {
- return $('.catalog-container').slideToggle();
- });
- return $catalogSection.find('li').click(function(e) {
- var $targetMenu;
- if (!$(e.target).closest('.menu__link').length) {
- $targetMenu = $(this).find('> ul');
- if ($targetMenu.length) {
- $('.' + $(this).parent().find('ul').attr('class')).not($targetMenu).slideUp();
- return $targetMenu.slideToggle();
- }
- }
- });
- };
- bind = function() {
- unbind();
- if (mobile) {
- return bindOnClick();
- } else {
- return bindOnHover();
- }
- };
- bind();
- return $(window).resize(function() {
- if (mobile !== (windowWidth <= 992)) {
- mobile = windowWidth <= 992;
- return bind();
- }
- });
- };
- window.initMap = function() {
- 'use strict';
- var $mapContainer, center, map, marker;
- $mapContainer = $('#map');
- center = {};
- if (!$mapContainer.length) {
- return false;
- }
- if ($mapContainer.closest('.map').hasClass('map_full')) {
- center = {
- lat: 53.933000,
- lng: 27.593500
- };
- } else {
- center = {
- lat: 53.934100,
- lng: 27.590000
- };
- }
- map = new google.maps.Map($mapContainer[0], {
- center: center,
- zoom: 17,
- scrollwheel: false,
- mapTypeControl: false,
- zoomControl: true,
- zoomControlOptions: {
- position: google.maps.ControlPosition.RIGHT_TOP
- },
- scaleControl: true,
- streetViewControl: true,
- streetViewControlOptions: {
- position: google.maps.ControlPosition.RIGHT_TOP
- },
- styles: [{
- 'featureType': 'all',
- 'elementType': 'all',
- 'stylers': [{
- 'saturation': -50
- }, {
- 'lightness': 30
- }]
- }]
- });
- marker = new google.maps.Marker({
- position: {
- lat: 53.934650,
- lng: 27.593650
- },
- map: map,
- title: 'Аквамарин',
- icon: new google.maps.MarkerImage('img/map-marker.png', new google.maps.Size(324, 234), new google.maps.Point(0, 0), new google.maps.Point(157, 60)),
- animation: google.maps.Animation.DROP
- });
- return marker.addListener('click', function() {
- var win;
- win = window.open('https://goo.gl/maps/cKskvzekppR2', '_blank');
- return win.focus();
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement