Entony преди 7 години
ревизия
41bee70e8b
променени са 8 файла, в които са добавени 184 реда и са изтрити 0 реда
  1. 3 0
      .bowerrc
  2. 1 0
      .gitignore
  3. 22 0
      bower.json
  4. 17 0
      css/jquery.gallary.css
  5. 0 0
      css/style.css
  6. 53 0
      index.html
  7. 59 0
      js/jquery.gallary.js
  8. 29 0
      js/script.js

+ 3 - 0
.bowerrc

@@ -0,0 +1,3 @@
+{
+	"directory": "lib/"
+}

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+lib/

+ 22 - 0
bower.json

@@ -0,0 +1,22 @@
+{
+  "name": "practics",
+  "authors": [
+    "Entony <leonskottkenedi@gmail.com>"
+  ],
+  "description": "",
+  "main": "",
+  "license": "MIT",
+  "homepage": "",
+  "private": true,
+  "ignore": [
+    "**/.*",
+    "node_modules",
+    "bower_components",
+    "test",
+    "tests"
+  ],
+  "dependencies": {
+    "bootstrap": "^3.3.7",
+    "jquery": "^3.2.1"
+  }
+}

+ 17 - 0
css/jquery.gallary.css

@@ -0,0 +1,17 @@
+.gallary {
+	padding: 0;
+	overflow: hidden;
+	position: relative;
+}
+
+.gallary .gallary-item {
+	position: absolute;
+	opacity: 0;
+	filter: blur(15px);
+	transition: opacity 0.5s, filter 0.5s;
+}
+
+.gallary .gallary-item.current {
+	opacity: 1;
+	filter: blur(0);
+}

+ 0 - 0
css/style.css


Файловите разлики са ограничени, защото са твърде много
+ 53 - 0
index.html


+ 59 - 0
js/jquery.gallary.js

@@ -0,0 +1,59 @@
+(function ($) {
+	'use strict';
+
+	$.fn.gallery = function(option) {
+		// console.log(this);
+
+		var defaults = {
+			current: 0
+		};
+
+		return this.each(function(){
+			var $gallery = $(this);
+			var $galleryitems = $gallery.children();
+
+			var options = $.extend(defaults, option); // переопределяем настройки по дефолту
+
+			$gallery.addClass('gallary');
+			$galleryitems.addClass('gallary-item');
+
+			$galleryitems.eq(options.current).addClass('current');
+
+			$galleryitems.eq(1).addClass('current');   // берет элемент в наборе и показывает его
+
+			$gallery.attr('tabindex', 0);
+
+			
+
+			var maxH = $($galleryitems[0]).height();
+			for (var i=0; i < $galleryitems.length; i++) {
+				if($($galleryitems[i]).height() < maxH ) maxH = $($galleryitems[i]).height(); 
+			}
+			
+			$gallery.height(maxH + 'px');
+
+			$gallery.on('keyup', function(event) {
+				var $currentItem = $('.current', $gallery);
+
+				if (event.which === 39) {
+					console.log('go r');
+
+					var next = $currentItem.index() + 1;
+					if (next === $galleryitems.length) next = 0;
+
+					
+				}else if(event.which === 37) {
+					console.log('go l');
+
+					var next = $currentItem.index() - 1;
+					if (next === $galleryitems.length) next = 0;
+				}
+
+				$galleryitems.removeClass('current').eq(next).addClass('current');  //удали нашли следующего и добавили
+
+			})
+		});
+	}
+
+
+})(jQuery);

+ 29 - 0
js/script.js

@@ -0,0 +1,29 @@
+// (function($) {
+
+// 	$.fn.futr = function() {
+// 		console.log(this);
+
+// 		this.each(function(i, item){
+// 			var children = $(item).children();
+
+// 			var maxH = $(children[0]).height();
+// 			for (var i=0; i < children.length; i++) {
+// 				if($(children[i]).height() < maxH ) maxH = $(children[i]).height(); 
+// 			}
+
+// 			$(children).height(maxH + 'px');
+// 			return this;
+// 		});
+// 	}
+// })(jQuery);
+
+// $('.container1, .container2')
+// 	.hide()
+// 	.fadeIn(1000)
+// 	.futr();
+
+$(function() {
+	$('#gallary').gallery({
+		current: 5
+	});
+});