PageSourceSearch

https://mpei.ru/Style%20Library/Portal/JS/carusel_hero.js

js mpei.ru collected 2026-10-01 10:27:10 UTC 1,849 bytes, 45 lines download raw bytes

1//Обработка клика на стрелку вправо
2$(document).on('click', ".hero-button-right",function(){ 
3	var hero = $(this).parents('.hero');
4	right_hero(hero);
5	return false;
6});
7//Обработка клика на стрелку влево
8$(document).on('click',".hero-button-left",function(){ 
9	var hero = $(this).parents('.hero');
10	left_hero(hero);
11	return false;
12});
13function left_hero(hero){
14   var block_width = $(hero).find('.hero-block').outerWidth();
15   $(hero).find(".hero-items .hero-block").eq(-1).clone().prependTo($(hero).find(".hero-items")); 
16   $(hero).find(".hero-items").css({"left":"-"+block_width+"px"});
17   $(hero).find(".hero-items .hero-block").eq(-1).remove();    
18   $(hero).find(".hero-items").animate({left: "0px"}, 400); 
19   
20}
21function right_hero(hero){
22   var block_width = $(hero).find('.hero-block').outerWidth();
23   $(hero).find(".hero-items").animate({left: "-"+ block_width +"px"}, 400, function(){
24	  $(hero).find(".hero-items .hero-block").eq(0).clone().appendTo($(hero).find(".hero-items")); 
25      $(hero).find(".hero-items .hero-block").eq(0).remove(); 
26      $(hero).find(".hero-items").css({"left":"0px"}); 
27   }); 
28}
29
30$(function() {
31//Раскомментируйте строку ниже, чтобы включить автоматическую прокрутку карусели
32	auto_right('.hero:first');
33})
34
35// Автоматическая прокрутка
36function auto_right(hero){
37	setInterval(function(){
38		if (!$(hero).is('.hover'))
39			right_hero(hero);
40	}, 8000)
41}
42// Навели курсор на карусель
43$(document).on('mouseenter', '.hero', function(){$(this).addClass('hover')})
44//Убрали курсор с карусели
45$(document).on('mouseleave', '.hero', function(){$(this).removeClass('hover')})

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.