PageSourceSearch

https://nao24.ru/engine/classes/js/prosto.slider.js

js nao24.ru collected 2026-10-02 08:45:45 UTC 11,904 bytes, 338 lines download raw bytes

1
2jQuery(document).ready(function(){
3		
4jQuery('.galleryimage').find('li').eq(0).addClass('active');
5/*jQuery('div.papa').find('ul').eq(1).addClass('zaza');*/
6if($('.papa').find('ul').hasClass("zaza2"))
7{
8	jQuery('div.papa').find('ul').eq(2).addClass('zaza');
9	jQuery('ul.zaza2').find('li').eq(0).addClass('active_k');
10}
11else
12{
13	jQuery('div.papa').find('ul').eq(1).addClass('zaza');
14}
15jQuery('ul.zaza').find('li').eq(0).addClass('active_k');
16
17});
18/*
19 * jQuery | Prosto Slider 
20 * http://kylaksizov.ru/
21 * Copyright 09.12.2015, KYLAKSIZOV
22*/
23
24$(function(){
25
26var count_slides=jQuery('.xfieldimagegallery').find('li').length;
27var step=5;
28var width_block=105;
29var ceil_=count_slides%step+1;
30var flag=false;
31jQuery('.zaza').append('<div class="total_count"><span  class="current_slide">1</span>/<span class="all_slides">'+count_slides+'</span></div>');
32var ss=jQuery('.xfieldimagegallery').html();
33jQuery('.papa').prepend('<div class="qq"><div class="test"><ul class="my_first_carousel">'+ss+'</ul></div></div>');
34if (count_slides>7)
35	jQuery('.qq').prepend('<div class="prev_btn"><</div><div class="next_btn">></div>');
36jQuery('.my_first_carousel').find('li').eq(0).addClass('active_slide');
37
38jQuery('.next_btn').click(function()
39{
40	if (jQuery(this).attr('disabled')=='disabled')
41		return false;
42	var current_margin=parseInt(jQuery('.my_first_carousel').css('margin-left'));
43	current_margin=current_margin-step*width_block;
44	
45	var limit=(-1)*(count_slides*width_block-600);
46	var current_margin_next=current_margin-step*width_block;
47	if ((current_margin_next>limit)&&(current_margin<=0))
48	{
49	}
50	else
51	{
52		jQuery(this).attr('disabled','disabled');
53		current_margin=parseInt(jQuery('.my_first_carousel').css('margin-left')) - ceil_*width_block;
54	}
55	if ((current_margin<=0)&&(current_margin>limit))
56	jQuery('.my_first_carousel').animate({marginLeft:current_margin},500);  
57	
58	return false;
59});
60
61jQuery('.prev_btn').click(function()
62{	
63	var current_margin=parseInt(jQuery('.my_first_carousel').css('margin-left'));
64	if (jQuery('.next_btn').attr('disabled')=='disabled')
65	{
66			current_margin=current_margin+ceil_*width_block;
67	}
68	else
69		current_margin=current_margin+step*width_block;
70	jQuery('.next_btn').removeAttr('disabled');
71	
72
73	if (current_margin<=0)
74jQuery('.my_first_carousel').animate({marginLeft:current_margin},500);  
75 
76	return false;
77});
78
79jQuery('.my_first_carousel').find('li').click(function()
80{
81	
82	jQuery('.my_first_carousel').find('li').removeClass('active_slide');
83	jQuery(this).addClass('active_slide');
84	var this_index=jQuery(this).index();
85	//this_index++;
86			
87		$('.xfieldimagegallery').find("li").stop(true, true).removeClass("active");
88		$('.xfieldimagegallery').find("li").eq(this_index).stop(true, true).addClass("active").fadeIn(5000);
89		
90		/*для первого слайда*/
91		/*var new_active = $(this).prev().children(".active");
92		var active_img=new_active.find('img').attr('src');
93		
94		jQuery('.my_first_carousel').find('li').removeClass('active_slide');
95		jQuery('.my_first_carousel').find('img[src="'+active_img+'"]').closest('li').addClass('active_slide');
96		/*для первого слайда*/
97		
98		/*--- Название и описание после слайдера если нужно ---*/
99	/*	var active_k = $(this).parent().next().children(".active_k");
100		if(active_k.prev("li").length){
101			active_k.prev().stop(true, true).addClass("active_k").fadeIn(5000).next().removeClass("active_k");
102		} else{
103			$(this).parent().next().children("li:last").stop(true, true).addClass("active_k").fadeIn(5000);
104			$(this).parent().next().children("li:first").stop(true, true).removeClass("active_k");
105		}
106		*/
107		//alert('fggh');
108		var active_li=$('.xfieldimagegallery').find('li.active').index();
109		
110		$(".zaza2").find("li").removeClass("active_k");
111		//alert(active_li);
112			$(".zaza2").find("li").eq(active_li).addClass("active_k");
113			$(".zaza").find("li").stop(true, true).removeClass("active_k");
114			$(".zaza").find("li").eq(active_li).stop(true, true).addClass("active_k").fadeIn(5000);
115			
116		
117		active_li++;
118		//alert(active_li);
119		jQuery('.current_slide').html(active_li);
120		
121		/*
122		var limit=(-1)*(count_slides*width_block-100);
123	var current_margin_next=current_margin-step*width_block;
124	
125	var current_margin=(-1)*this_index*width_block;
126	
127	if ((current_margin_next>limit)&&(current_margin<=0))
128	{
129	}
130	else
131	{
132		jQuery(this).attr('disabled','disabled');
133		current_margin=parseInt(jQuery('.my_first_carousel').css('margin-left')) - ceil_*width_block;
134	}
135	
136			
137			jQuery('.my_first_carousel').animate({marginLeft:current_margin},500);  
138	
139		
140	*/	
141});
142
143
144	/* SLIDER */
145
146	function SliderAutoHeight(){
147		$(".slider img").each(function(){
148			var slideImg = $(this).height();
149			$(this).parents(".slider").css("height", slideImg + "px");
150		})
151	}
152	
153	function SliderAutoHeight1(){
154		$(".my_first_carousel img").each(function(){
155			var slideImg = $(this).height();
156			$(this).css("height", "64px");
157		})
158	}
159	
160
161	 // если в слайдере вставлено видео
162	function IframeAutoHeight(){
163		$(".slider iframe").each(function(){
164			var slideIframe = $(this).height();
165			$(this).parents(".slider").css("height", slideIframe + "px");
166		})
167	}
168
169	setTimeout(function(){ // без этого сразу не работает, ждём одну не знаметную секунду
170
171        SliderAutoHeight();
172		SliderAutoHeight1();
173        IframeAutoHeight(); // если в слайдере вставлено видео
174    }, 300);
175
176	// При изменении рзмера экрана назнаяаем новую высоту слайдеру зависимую от высоты картинок
177	$(window).resize(function(){
178		SliderAutoHeight();
179		SliderAutoHeight1();
180		IframeAutoHeight(); // если в слайдере вставлено видео
181	})
182
183	// Кнопка вперёд
184	$("body").on("click", ".next", function(){
185		var zz=jQuery('.active_slide').index();
186	//	alert(zz);
187		//alert(count_slides);
188		
189		if ((zz-1)==count_slides)
190			return false;
191		
192	
193		var active = $(this).prev().prev().children(".active");
194	
195		if(active.next("li").length){ // если ещё есть li
196			active.next().stop(true, true).addClass("active").fadeIn(5000).prev().removeClass("active");
197			
198		} else{
199			$(this).prev().prev().children("li:first").stop(true, true).addClass("active").fadeIn(5000);
200			$(this).prev().prev().children("li:last").stop(true, true).removeClass("active");
201		}
202		
203		/*для первого слайда*/
204		var new_active = $(this).prev().prev().children(".active");
205		var active_img=new_active.find('img').attr('src');
206		
207		jQuery('.my_first_carousel').find('li').removeClass('active_slide');
208		jQuery('.my_first_carousel').find('img[src="'+active_img+'"]').closest('li').addClass('active_slide');
209		/*для первого слайда*/
210		
211		/*--- Название и описание после слайдера если нужно ---*/
212		var active_k = $(this).parent().next().children(".active_k");
213		
214		if(active_k.next("li").length){
215			/*active_k.next().stop(true, true).addClass("active_k").fadeIn(5000).prev().removeClass("active_k");*/
216			$(".zaza2").find("li").eq(zz).next().stop(true, true).addClass("active_k").fadeIn(5000).prev().removeClass("active_k");
217			$(".zaza").find("li").eq(zz).next().stop(true, true).addClass("active_k").fadeIn(5000).prev().removeClass("active_k");
218		} else{
219			$(".zaza2").find("li").eq(0).stop(true, true).addClass("active_k").fadeIn(5000);
220			/*$(this).parent().next().children("li:first").stop(true, true).addClass("active_k").fadeIn(5000);
221			$(this).parent().next().children("li:last").stop(true, true).removeClass("active_k");*/
222			$(".zaza2").find("li").eq(zz).removeClass("active_k");
223			$(".zaza").find("li").eq(0).stop(true, true).addClass("active_k").fadeIn(5000);
224			$(".zaza").find("li").eq(zz).removeClass("active_k");
225		}
226		
227		var active_li=$('.xfieldimagegallery').find('li.active').index();
228		var flag1=false;
229	//	alert(jQuery('.my_first_carousel').css('margin-left'));
230	
231	//var qq=active_li-9;
232	
233		if (((active_li%9==0)&&(jQuery('.my_first_carousel').css('margin-left')=='0px') ) /*|| (qq%step==0) */)
234			flag1=true;
235		if ((active_li%step==0)||(flag1==true))
236		{
237			
238			var current_margin=parseInt(jQuery('.my_first_carousel').css('margin-left'));
239			//alert('fdfdg');
240			current_margin=current_margin-step*width_block;
241			//alert(current_margin);
242			var limit=(-1)*(count_slides*width_block-600);
243			
244			if ((current_margin<=0)&&(current_margin>limit))
245			{
246				
247				var current_margin_next=current_margin-step*width_block;
248				if ((current_margin_next>limit)&&(current_margin<=0))
249				{
250				}
251				else
252				{
253					jQuery(this).attr('disabled','disabled');
254					current_margin=parseInt(jQuery('.my_first_carousel').css('margin-left')) - ceil_*width_block;
255				}
256			//сюда
257			jQuery('.my_first_carousel').animate({marginLeft:current_margin},500);  
258			}
259			else 
260			{
261				if (active_li==0)
262					jQuery('.my_first_carousel').animate({marginLeft:0},500);  
263			}
264		}
265		active_li++;
266		jQuery('.current_slide').html(active_li);
267		/*--- Название и описание после слайдера если нужно END---*/
268		return false;
269	})
270
271	// Кнопка назад
272	$("body").on("click", ".prev", function(){
273		var zz=jQuery('.active_slide').index();
274		if (zz==0)
275			return false;
276		var active = $(this).prev().children(".active");
277		if(active.prev("li").length){ // если ещё есть li
278			active.prev().stop(true, true).addClass("active").fadeIn(5000).next().removeClass("active");
279		} else{
280			$(this).prev().children("li:last").stop(true, true).addClass("active").fadeIn(5000);
281			$(this).prev().children("li:first").stop(true, true).removeClass("active");
282		}
283		
284		/*для первого слайда*/
285		var new_active = $(this).prev().children(".active");
286		var active_img=new_active.find('img').attr('src');
287		
288		jQuery('.my_first_carousel').find('li').removeClass('active_slide');
289		jQuery('.my_first_carousel').find('img[src="'+active_img+'"]').closest('li').addClass('active_slide');
290		/*для первого слайда*/
291		
292		/*--- Название и описание после слайдера если нужно ---*/
293		var active_k = $(this).parent().next().children(".active_k");
294		if(active_k.prev("li").length){
295			/*active_k.prev().stop(true, true).addClass("active_k").fadeIn(5000).next().removeClass("active_k");*/
296			$(".zaza2").find("li").eq(zz).prev().stop(true, true).addClass("active_k").fadeIn(5000).next().removeClass("active_k");
297			$(".zaza").find("li").eq(zz).prev().stop(true, true).addClass("active_k").fadeIn(5000).next().removeClass("active_k");
298		} else{
299			/*$(this).parent().next().children("li:last").stop(true, true).addClass("active_k").fadeIn(5000);
300			$(this).parent().next().children("li:first").stop(true, true).removeClass("active_k");*/
301			$(".zaza").find("li").eq(0).removeClass("active_k");
302			$(".zaza").find("li:last").stop(true, true).addClass("active_k").fadeIn(5000);
303			
304			$(".zaza2").find("li").eq(0).removeClass("active_k");
305			$(".zaza2").find("li:last").stop(true, true).addClass("active_k").fadeIn(5000);
306		}
307		
308		var active_li=$('.xfieldimagegallery').find('li.active').index();
309		var old_active_li=active_li;
310		active_li++;
311		
312		if (active_li%5==0)
313		{
314		var current_margin=parseInt(jQuery('.my_first_carousel').css('margin-left'));
315		current_margin=current_margin+step*width_block;
316	if (current_margin<=0)
317
318jQuery('.my_first_carousel').animate({marginLeft:current_margin},500);  
319 
320		}
321		else {
322			if ((old_active_li+2)==count_slides)
323			{
324				var tt=(-1)*(count_slides-9)*width_block-600;
325				jQuery('.my_first_carousel').animate({marginLeft:tt},500);  
326				//alert('fdsf');
327			}
328		}
329		
330		jQuery('.current_slide').html(active_li);
331		
332		/*--- Название и описание после слайдера если нужно END---*/
333		return false;
334	})
335
336	/* SLIDER */
337
338})

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.