Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Optymalizacja wyświetlania galerii

  • Loading branch information...
commit 08b800da789351763db9831626d6b358c1fbfa16 1 parent 6d4d91e
authored April 11, 2012
1  application/controllers/GalleryController.php
@@ -18,6 +18,7 @@ public function init()
18 18
 	public function indexAction() {
19 19
 		$mapper = new Application_Model_GalleryMapper();
20 20
 		$this->view->galleries = $mapper->fetchAll(null, 'folder_date DESC', 20);
  21
+		
21 22
 		foreach ($this->view->galleries as $key => $gallery) {
22 23
 			if (!$gallery->getPhotos()) unset($this->view->galleries[$key]);
23 24
 		}
1  application/layouts/scripts/layout.phtml
@@ -6,6 +6,7 @@
6 6
 	<?php echo $this->headLink()->appendStylesheet('/css/global.css') ?>
7 7
 	<?php echo $this->headScript()
8 8
 		->prependFile('/js/main.js')
  9
+		->prependFile('/js/jquery-ui-1.8.18.min.js')
9 10
 		->prependFile('/js/jquery-1.7.2.min.js') ?>
10 11
 	
11 12
 	<script type="text/javascript">
1  application/layouts/scripts/layout_en.phtml
@@ -6,6 +6,7 @@
6 6
 	<?php echo $this->headLink()->appendStylesheet('/css/global.css') ?> 
7 7
 	<?php echo $this->headScript()
8 8
 		->prependFile('/js/main.js')
  9
+		->prependFile('/js/jquery-ui-1.8.18.min.js')
9 10
 		->prependFile('/js/jquery-1.7.2.min.js') ?>
10 11
 	
11 12
 	<script type="text/javascript">
28  application/views/scripts/gallery/index.phtml
... ...
@@ -1,12 +1,20 @@
20  baza/buffet_dml.sql
@@ -140,7 +140,25 @@ INSERT INTO `picture` (`id`, `name`, `information`, `main_picture`, `gallery_id`
140 140
 (55, '/galleries/1/photo20.jpg', NULL, NULL, 1, '2012-03-31 00:00:00', 'seta', NULL),
141 141
 (56, '/galleries/1/photo21.jpg', NULL, NULL, 1, '2012-03-31 00:00:00', 'seta', NULL),
142 142
 (57, '/galleries/1/photo22.jpg', NULL, NULL, 1, '2012-03-31 00:00:00', 'seta', NULL),
143  
-(58, '/galleries/1/photo23.jpg', NULL, NULL, 1, '2012-03-31 00:00:00', 'seta', NULL);
  143
+(58, '/galleries/1/photo23.jpg', NULL, NULL, 1, '2012-03-31 00:00:00', 'seta', NULL),
  144
+(59, '/galleries/1/photo1.jpg', NULL, NULL, 3, '2012-03-31 00:00:00', 'seta', NULL),
  145
+(60, '/galleries/1/photo2.jpg', NULL, 'Y', 3, '2012-03-31 00:00:00', 'seta', NULL),
  146
+(61, '/galleries/1/photo3.jpg', NULL, NULL, 3, '2012-03-31 00:00:00', 'seta', NULL),
  147
+(62, '/galleries/1/photo4.jpg', NULL, NULL, 3, '2012-03-31 00:00:00', 'seta', NULL),
  148
+(63, '/galleries/1/photo5.jpg', NULL, NULL, 3, '2012-03-31 00:00:00', 'seta', NULL),
  149
+(64, '/galleries/1/photo6.jpg', NULL, NULL, 3, '2012-03-31 00:00:00', 'seta', NULL),
  150
+(65, '/galleries/1/photo7.jpg', NULL, NULL, 3, '2012-03-31 00:00:00', 'seta', NULL),
  151
+(66, '/galleries/1/photo8.jpg', NULL, NULL, 3, '2012-03-31 00:00:00', 'seta', NULL),
  152
+(67, '/galleries/1/photo9.jpg', NULL, NULL, 3, '2012-03-31 00:00:00', 'seta', NULL),
  153
+(68, '/galleries/1/photo10.jpg', NULL, NULL, 4, '2012-03-31 00:00:00', 'seta', NULL),
  154
+(69, '/galleries/1/photo11.jpg', NULL, NULL, 4, '2012-03-31 00:00:00', 'seta', NULL),
  155
+(70, '/galleries/1/photo12.jpg', NULL, NULL, 4, '2012-03-31 00:00:00', 'seta', NULL),
  156
+(71, '/galleries/1/photo13.jpg', NULL, NULL, 4, '2012-03-31 00:00:00', 'seta', NULL),
  157
+(72, '/galleries/1/photo14.jpg', NULL, NULL, 4, '2012-03-31 00:00:00', 'seta', NULL),
  158
+(73, '/galleries/1/photo15.jpg', NULL, NULL, 4, '2012-03-31 00:00:00', 'seta', NULL),
  159
+(74, '/galleries/1/photo16.jpg', NULL, NULL, 4, '2012-03-31 00:00:00', 'seta', NULL),
  160
+(75, '/galleries/1/photo17.jpg', NULL, NULL, 4, '2012-03-31 00:00:00', 'seta', NULL),
  161
+(76, '/galleries/1/photo18.jpg', NULL, 'Y', 4, '2012-03-31 00:00:00', 'seta', NULL);
144 162
 
145 163
 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
146 164
 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
39  public/css/global.css
@@ -568,13 +568,33 @@ color		: #FFFFFF;
568 568
 }
569 569
 
570 570
 #galleries {
571  
-	height: 600px;
572  
-	background: blue;
573  
-	overflow: hidden
  571
+	border-collapse: collapse;
  572
+	border-spacing: 0px;
574 573
 }
575 574
 
576 575
 #galleries .gallery {
577  
-	float: left;
  576
+	width: 230px;
  577
+	height: 600px;
  578
+	overflow: hidden;
  579
+	margin: 4px;
  580
+	margin-top: 0px;
  581
+}
  582
+
  583
+#galleries .gallery > div {
  584
+	width: 620px;
  585
+	text-align: center;
  586
+	margin-left: -55%;
  587
+}
  588
+
  589
+#galleries .gallery > div.active {
  590
+	margin-left: 0;
  591
+}
  592
+
  593
+#galleries tr:first-child .gallery {
  594
+	margin-left: 0px;
  595
+}
  596
+
  597
+#galleries .gallery.active {
578 598
 	width: 620px;
579 599
 }
580 600
 
@@ -582,12 +602,23 @@ color		: #FFFFFF;
582 602
 	width: 500px;
583 603
 	float: left;
584 604
 	overflow: hidden;
  605
+	position: relative;
  606
+}
  607
+
  608
+#galleries .gallery.active .preview {
  609
+	left: 0;
585 610
 }
586 611
 
587 612
 #galleries .gallery .preview img {
588 613
 	height: 600px;
589 614
 }
590 615
 
  616
+#galleries .gallery .thumbnails {
  617
+	float: left;
  618
+	width: 120px;
  619
+	overflow: hidden;
  620
+}
  621
+
591 622
 #galleries .gallery .thumbnail {
592 623
 	float: left;
593 624
 	width: 50px;
356  public/js/jquery-ui-1.8.18.min.js
356 additions, 0 deletions not shown
18  public/js/main.js
... ...
@@ -0,0 +1,18 @@
  1
+$(function () {
  2
+	$('#galleries .gallery').on('click', function () {
  3
+		var slideTime = 700, 
  4
+			$active = $('#galleries .gallery.active');
  5
+		
  6
+		if ($active.length && $active.get(0) == this) {
  7
+			return;
  8
+		}
  9
+		$active.removeClass("active", slideTime );
  10
+		$active.children().removeClass("active", slideTime );
  11
+		$(this).addClass( "active", slideTime );
  12
+		$(this).children().addClass( "active", slideTime );
  13
+	});
  14
+	
  15
+	$('#galleries .thumbnail img').on('click', function () {
  16
+		$(this).parents('.gallery').find('.preview img').attr('src', $(this).attr('src'));
  17
+	});
  18
+});

0 notes on commit 08b800d

Please sign in to comment.
Something went wrong with that request. Please try again.