tessguefen
11/11/2015 - 7:37 PM

ts | pinch zoom thingy

ts | pinch zoom thingy


			var pswpElement = document.querySelectorAll('.pswp')[0];
			var items = [];
			function nextImage(i) {
				if (i < global_large.length) {
					var theImage = new Image();
					var theSrc = global_large[i];
						theImage.src = theSrc;
					theImage.onload = function() {
						var imageWidth = this.width;
						var imageHeight = this.height;
						items.push(
							{
						        src: this.src,
						        w: imageWidth,
						        h: imageHeight
						    }
						);
						//console.log(items);
						i++;
						nextImage(i)
					}
				}
			}
			nextImage(0);
			var currentIndex = 0;
			$('#thumbnails li').click(function(){
				currentIndex = $(this).index();
			});
			
			$('#main_image').click(function(){
				// define options (if needed)
				var options = {
				    // optionName: 'option value'
				    // for example:
				    index: currentIndex // start at first slide
				};

				// Initializes and opens PhotoSwipe
				var gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options);
				gallery.init();
			});