View file KinoMIX/js/index.js

File size: 6.1Kb
//Авторизация
$(document).ready(function() { // вся магия после загрузки страницы
	$('a#go').click( function(event){ // ловим клик по ссылки с id="go"
		event.preventDefault(); // выключаем стандартную роль элемента
		$('#overlay').fadeIn(400, // сначала плавно показываем темную подложку
		 	function(){ // после выполнения предыдущей анимации
				$('#login') 
					.css('display', 'block') // убираем у модального окна display: none;
					.animate({opacity: 1, top: '40%'}, 200); // плавно прибавляем прозрачность одновременно со съезжанием вниз
		});
	});
	/* Закрытие модального окна, тут делаем то же самое но в обратном порядке */
	$('#modal_close, #overlay').click( function(){ // ловим клик по крестику или подложке
		$('#login')
			.animate({opacity: 0, top: '45%'}, 200,  // плавно меняем прозрачность на 0 и одновременно двигаем окно вверх
				function(){ // после анимации
					$(this).css('display', 'none'); // делаем ему display: none;
					$('#overlay').fadeOut(400); // скрываем подложку
				}
			);
	});
});
$(document).ready(function() {	
	$('.popular-movies-right li:odd,#last-news li:even').css("background-color","#f9f9f9");

	// Слайдер трейлеров фильмов
	$('#slider').slidesjs({
        width: 960,
        height: 440,
        navigation: {
          active: true,
          effect: "fade"
        },
		play: {
          auto: true,
          effect: "fade",
          interval: 6000,
          swap: true,
          restartDelay: 2500
        },
        pagination: {
            active: true,
            effect:"fade"
        },
        
        
      });
	  
	//Эффект наведения
	$(".movie-poster,.movie-big-content,.related-movies li").hover(
		function(){$(this).children(".play").fadeIn('fast');},
		function(){$(this).children(".play").fadeOut('fast');
	});
	
	
	// Переключатель блоков с фильмами на главной странице
        $(function() {
            $('ul#left-movies-tabs').on('click', 'li:not(active)', function() {
		        $(this).addClass('active').siblings().removeClass('active')
			    .parents('div#left-movies-block').find('div.box').eq($(this).index()).fadeIn(150).siblings('div.box').hide();
	        })
        })
    
	
	// Рекомендуемые фильмы
	$('.movie-big-content').html($('.movie-small li:first div.movie-hidden').html());
	$('.movie-small li:first').addClass('active'); 
	$('.movie-small li:last').css('border-bottom',"none");
	$('.movie-small img').mouseover(function(e){
		if($(window).width()<=480) return;
		obj = $(this);
		
		$('.movie-small li').removeClass('active');
		obj.parents('li').addClass('active');
			
		$('.movie-big-content').fadeOut(400,function(){
			$(this).html(obj.parents('li').find('div.movie-hidden').html());
		
		$('.movie-big-content').fadeIn(400);	
			});
		e.preventDefault();
	}); 
	
	// Слайдер обновлений сериалов
	jQuery(".new-series-slider").show();	
	function setSecondSliderNavi( $c, $i ) {		
		var $prev = ($i.is(':first-child')) ? $c.children().last() : $i.prev();						
		var prev_post_title = $prev.find('div.alt').find('h3 a').text();
		var prev_post_date = $prev.find('span.date').text();
		jQuery('#s-prev').html('<div class="prev-serie"><div class="btn-prev"><i class="fa fa-chevron-left">&nbsp;</i></div><div class="prev-info"><h6>'+prev_post_title+'</h6><div class="date">'+prev_post_date+'</div></div></div>');				
				
		var $next = $i.next();
		var next_post_title = $next.find('div.alt').find('h3 a').text();
		var next_post_date = $prev.find('span.date').text();
		jQuery('#s-next').html('<div class="next-serie"><div class="btn-next"><i class="fa fa-chevron-right">&nbsp;</i></div><div class="next-info"><h6>'+next_post_title+'</h6><div class="date">'+next_post_date+'</div></div></div>');
	}
	jQuery('#new-series-slider-content').carouFredSel({
		auto : {
			timeoutDuration: 4000,
			pauseOnHover: true
		},
		responsive	: true,
		prev: '#s-prev',
		next: '#s-next',
		scroll: {
			onBefore: function( data ) {
			setSecondSliderNavi( jQuery(this), data.items.visible );
			}
		},
		onCreate: function( data ) {
			setSecondSliderNavi( jQuery(this), data.items );
		}
	});	
	
	// Слайдер новинок
	jQuery('#featured-slider').minislides({										
		width:940,
		height:263,							
		slides:6,
		padding:10,
		ease:'easeOutQuad',
		speed:200,
		hidetoolbar:0,
		animtype:1,
		mousewheel:'off',
		touchenabled:'off'
	});
	$(".movie-present-slide").hover(
		function(){$(this).children(".play").fadeIn('fast');},
		function(){$(this).children(".play").fadeOut('fast');
		
	});
	
	
	
	
	/* Галерея */
	$(".swipebox").swipebox();
			
	// Режим кинотеатра
	$(".action-buttons .lightoff").click(function(){
		var t = $(".action-buttons .lightoff span" );
		if(t.text() =="Включить свет"){
			t.text("Выключить свет");
			$("#lights-off").fadeOut("fast").animate({opacity:0});;
		}
		else{
			t.text("Включить свет");
			$("#lights-off").fadeIn("fast").animate({opacity:0.90});;
		}
		return false;
	});
	
	
	// Кнопка Развернуть
	$(".watch-top .expand").click(function(){
		var t = $(".watch-top .expand" );
		if(t.text() =="Свернуть"){
			t.text("Развернуть");
			$('.watch-top .slide-block,.watch-top .slide-desc').removeClass('raise', {duration:500});
			$('.slider-tags').animate().height('28px');
		}
		else{
			t.text("Свернуть");
			$('.watch-top .slide-block,.watch-top .slide-desc').addClass('raise', {duration:500});
			$('.slider-tags').animate().height('auto');
		}
		return false;
	});
	
	
});