Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery(function($) {
- var self,
- wnd = $(window),
- wWidth, wHeight;
- if (wnd.width() < 980) {
- wWidth = 980;
- } else {
- wWidth = wnd.width();
- }
- if (wnd.height() < 650) {
- wHeight= 650
- } else {
- wHeight = wnd.height();
- }
- wnd.on('resize', function() {
- if (wnd.width() < 980) {
- wWidth = 980;
- } else {
- wWidth = wnd.width();
- }
- if (wnd.height() < 650) {
- wHeight= 650
- } else {
- wHeight = wnd.height();
- }
- });
- var dropdown = {
- init : function() {
- $('.menu .level1 li').on({
- 'mouseenter' : function() {
- self = $(this);
- self.addClass('opened');
- if (self.find('.level2').size()) {
- self.find('.level2').stop(true,true).animate({
- opacity : 'show',
- height : 'show'
- });
- }
- },
- 'mouseleave' : function() {
- self = $(this);
- self.removeClass('opened');
- if (self.find('.level2').size()) {
- self.find('.level2').stop(true,true).animate({
- opacity : 'hide',
- height : 'hide'
- });
- }
- }
- });
- }
- };
- dropdown.init();
- var dropdownSide = {
- init : function() {
- var self;
- $('.sidebar .level1 > li').on({
- 'mouseenter' : function() {
- self = $(this);
- self.find('.level2').stop(true,true).animate({
- height : 'show'
- });
- },
- 'mouseleave' : function() {
- self = $(this);
- if (!self.hasClass('active-trail')) {
- self.find('.level2').stop(true,true).animate({
- height : 'hide'
- },100);
- }
- }
- });
- }
- };
- dropdownSide.init();
- $('.toggle-link').on('click', function() {
- self = $(this);
- self.closest('.toggle-block').siblings('.opened').removeClass('opened').find('.block').stop().animate({
- height : 'hide',
- opacity : 'hide'
- });
- self.closest('.toggle-block').toggleClass('opened').find('.block').stop().animate({
- height : 'toggle',
- opacity : 'toggle'
- });
- return false;
- });
- var toggleWindow = {
- init : function() {
- this.toggleHeader();
- this.toggleFooter();
- },
- toggleHeader : function() {
- var margin,
- header = $('header.header'),
- contacts = $('.toggle-contacts');
- margin = contacts.outerHeight();
- contacts.css({display:'block'});
- header
- .css({marginTop:'-'+margin+'px'})
- .find('.toggle-close').on('click', function() {
- header.stop().animate({
- marginTop : -margin
- }, 1000, 'easeOutCubic');
- return false;
- });
- $('.toggle-tel').on('click', function() {
- self = $(this);
- if ($(this).hasClass('toggled')) {
- self.removeClass('toggled');
- header.stop().animate({
- marginTop : -margin + $('body,html').scrollTop()
- }, 1000, 'easeOutQuart', function() {
- header.css({marginTop:-margin});
- $('body,html').scrollTop(0);
- });
- } else {
- self.addClass('toggled');
- header.stop().animate({
- marginTop : 0
- }, 1000, 'easeOutQuart');
- $('.footer .toggle-link.toggled').trigger('click');
- }
- return false;
- });
- },
- toggleFooter : function() {
- var height,
- footer = $('footer.footer'),
- holder = $('footer.footer .toggle-holder'),
- link = footer.find('.toggle-link'),
- close = footer.find('.toggle-close'),
- fHeight = $('.menu').height() + 52;
- link.on('click', function() {
- self = $(this);
- holder = self.closest('.toggle-holder');
- height = holder.height() + 131;
- if (self.hasClass('toggled')) {
- self.removeClass('toggled');
- self.closest('.footer-holder').stop().animate({
- height: 131
- }, 'easeOutQuart', function() {
- holder.siblings().removeClass('sibling')
- });
- } else {
- self.addClass('toggled');
- holder.css({zIndex:10}).siblings().addClass('sibling');
- self.closest('.footer-holder').stop().animate({
- height: height
- }, 'easeOutQuart');
- $('.toggle-tel.toggled').trigger('click');
- }
- return false;
- });
- close.on('click', function() {
- holder = $(this).closest('.toggle-holder');
- $('.footer-holder').stop().animate({
- height: 131
- }, 'easeOutQuart', function() {
- holder.siblings().removeClass('sibling')
- }).find('.toggle-link').removeClass('toggled');
- return false;
- })
- }
- };
- toggleWindow.init();
- var indexSlider = {
- init : function() {
- var slider = $('#index-slider'),
- viewport = slider.find('.viewport'),
- overview = slider.find('.overview'),
- slide = slider.find('.slide'),
- thumbs = slider.find('.thumbs'),
- close = slider.find('.toggle-close'),
- buttons = slider.find('.slider-button'),
- holder = '',
- self, index, width, flag = 0, hoverFlag = 0,
- strut = slider.find('.strut'),
- layer = slider.find('.layer'),
- layer1 = slider.find('.layer-1'),
- layer2 = slider.find('.layer-2'),
- layer3 = slider.find('.layer-3'),
- overlay = slider.find('.overlay'),
- header = $('header.header'),
- footer = $('footer.footer'),
- time, method;
- if ($('body').hasClass('front')) {
- $('html').css({height:'auto'});
- }
- slide.each(function() {
- self = $(this);
- holder += '<a href="#"></a>';
- });
- thumbs.html(holder).find('a').first().addClass('active');
- reSet(wWidth);
- wnd.on({
- 'resize' : function() {
- reSet(wWidth);
- },
- 'mousemove' : function(event) {
- if (slider.hasClass('unpack') && (event.pageY < 100 || event.pageY > wHeight - 100)) {
- precoverSlider()
- } else if (slider.hasClass('unpack') && (event.pageY >= 100 || event.pageY <= wHeight - 100)) {
- revealSlider();
- }
- },
- 'click' : function() {
- if (slider.hasClass('midi')) {
- coverSlider();
- return false;
- }
- }
- });
- setDisable();
- buttons.on('click', function() {
- self = $(this);
- if (!self.hasClass('disable')) {
- if (self.hasClass('next')) {
- index = thumbs.find('.active').next().index();
- thumbs.find('.active').removeClass('active').next().addClass('active');
- } else if (self.hasClass('prev')) {
- index = thumbs.find('.active').prev().index();
- thumbs.find('.active').removeClass('active').prev().addClass('active');
- }
- slideTo(index);
- setDisable();
- }
- $(this).blur();
- return false;
- });
- thumbs.find('a').on('click', function() {
- self = $(this);
- self.addClass('active').siblings('.active').removeClass('active');
- slideTo(self.index());
- setDisable();
- return false;
- });
- close.on('click', function() {
- coverSlider();
- return false;
- });
- overlay.on({
- 'click' : function() {
- if (slider.hasClass('midi')) {
- coverSlider();
- } else {
- revealSlider();
- }
- return false;
- }
- });
- function reSet(wWidth) {
- overview.css({width:wWidth*slide.size()});
- slide.css({width:wWidth});
- layer.css({width:wWidth*1.5*slide.size()});
- slider.css({minHeight:wHeight});
- strut.css({minHeight:wHeight});
- slide.each(function() {
- self = $(this);
- self.css({left:wWidth*self.index()});
- });
- index = $('.thumbs').find('.active').index();
- overview.css({left:-index*wWidth});
- layer1.css({left:-index*wWidth*0.5});
- layer2.css({left:-index*wWidth*0.25});
- layer3.css({left:-index*wWidth*0.15});
- }
- function slideTo(index) {
- overview.stop().animate({
- left : -index*wWidth
- }, 1500, 'easeOutQuint');
- layer1.stop().animate({
- left: -index*wWidth*0.2
- }, 1500, 'easeOutQuint');
- layer2.stop().animate({
- left: index*wWidth*0.2
- }, 1500, 'easeOutQuint');
- layer3.stop().animate({
- left: index*wWidth*0.4
- }, 1500, 'easeOutQuint');
- }
- function setDisable() {
- buttons.removeClass('disable');
- if (thumbs.find('.active').is(':last-child')) {
- buttons.filter('.next').addClass('disable');
- } else if (thumbs.find('.active').is(':first-child')) {
- buttons.filter('.prev').addClass('disable');
- }
- }
- function revealSlider() {
- slider.addClass('unpack');
- if (slider.hasClass('midi')) {
- time = 2000;
- } else {
- time = 1000;
- }
- header.stop().animate({
- top: - header.find('.wrapper').last().height() - 9,
- marginTop : - $('.toggle-contacts').height()
- }, time, 'easeOutExpo');
- $('.toggle-tel').removeClass('toggled');
- footer.stop().animate({
- bottom: - 131
- }, time, 'easeOutExpo').find('.footer-holder').stop().animate({
- height: 131
- }, 'easeOutQuart', function() {
- $('.toggle-holder').siblings().removeClass('sibling');
- $('.toggle-link').removeClass('toggled');
- });
- // $(overlay).css({display:'none'});
- buttons.stop(true,true).animate({
- opacity : 'show'
- });
- thumbs.stop(true,true).animate({
- opacity : 'show'
- });
- close.stop(true,true).animate({
- opacity : 'show'
- });
- }
- function coverSlider() {
- slider.removeClass('unpack').removeClass('midi');
- header.stop().animate({
- top: 0
- }, 1000, 'easeOutExpo');
- footer.stop().animate({
- bottom: 0
- }, 1000, 'easeOutExpo');
- // $(overlay).css({display:'block'});
- buttons.stop(true,true).animate({
- opacity : 'hide'
- });
- thumbs.stop(true,true).animate({
- opacity : 'hide'
- });
- close.stop(true,true).animate({
- opacity : 'hide'
- });
- }
- function precoverSlider() {
- slider.addClass('midi');
- header.stop().animate({
- top: -50
- }, 2000, 'easeOutExpo');
- footer.stop().animate({
- bottom: -50
- }, 2000, 'easeOutExpo');
- }
- $('#gofirst').on('click', function() {
- $('#index-slider .thumbs a:first').trigger('click');
- coverSlider();
- return false;
- });
- }
- };
- if ($('#index-slider').size()) {
- indexSlider.init();
- }
- var menuTracking = {
- init : function() {
- var menu = $('.menu'),
- level1 = menu.find('.level1'),
- mWidth = level1.outerWidth(),
- leftB = level1.offset().left + 60,
- rightB = level1.offset().left + mWidth - 60;
- wnd.on('resize', function() {
- leftB = menu.offset().left;
- rightB = menu.offset().left + mWidth;
- });
- wnd.on({
- 'mousemove' : function (event) {
- if (event.pageX >= 60 && event.pageX <= wWidth - 60) {
- level1.find('.bar').css({left:(event.pageX - 60)});
- }
- }
- });
- }
- };
- menuTracking.init();
- //file
- $('.region-footer-right #edit-file').wrap('<div class="file-block"></div>').after('<div class="file-text"></div><a class="file-button"></a>');
- $('.region-footer-right .file-block .file-button').on('click', function() {
- $('#edit-file').trigger('click');
- return false;
- });
- $('.region-footer-right #edit-file').on('change', function() {
- $('.file-block .file-text').text($(this).val().replace(/.+[\\\/]/, ""));
- });
- $('.region-content #edit-file').before('<a href="javascript:void(0);" onclick="open_dialog();">выберите файл</a>');
- open_dialog = function(){
- $('#edit-file_wrap input:last').trigger('click');
- }
- $('.region-content #edit-file_wrap> a').after($('#webform-component-file .description'));
- //
- //captcha
- /*var a=Math.floor( Math.random() * 10 ) ;
- var b=Math.floor( Math.random() * 10 ) ;
- var c =a+b;
- jQuery('#webform-component-file').prepend('<div><label for="capt">'+a+'+'+b+'=</label><input class="captch" id="capt" style="height:30px"></div>');
- jQuery('.form-textarea').css('min-height','128px').css('max-height','128px').css('height','128px');
- */
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement