jQuery(document).ready(function() {

  //vote_slider
  var owl = $(".owl-demo.projects_slider");
  owl.owlCarousel({
  navigation: true,
  navigationText : ["",""],
  pagination: false,
  items : 6,
  //itemsDesktop : [1000,4],
  itemsDesktop : [600,3],
  margin: 10,
  autoHeight: true

});

  $(".mfp-gallery").each(function() {
		$(this).magnificPopup({
			delegate: 'a',
			mainClass: 'mfp-zoom-in',
			type: 'image',
			tLoading: '',
      image: {
			verticalFit: true,
			titleSrc: function(item) {
        var caption = item.el.attr('title');
        return caption;
			}
		},
			gallery:{
				enabled: true,
        navigateByImgClick: true,
  			preload: [0,1], // Will preload 0 - before current, and 1 after the current image
        navigateByImgClick: true,
        arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', // markup of an arrow button
        tPrev: 'Previous (Left arrow key)', // title for left button
        tNext: 'Next (Right arrow key)', // title for right button
        tCounter: '<span class="mfp-counter">%curr% of %total%</span>' // markup of counter
			},
			removalDelay: 300,
			callbacks: {
				beforeChange: function() {
					this.items[0].src = this.items[0].src + '?=' + Math.random();
				},
				open: function() {
					$.magnificPopup.instance.next = function() {
						var self = this;
						self.wrap.removeClass('mfp-image-loaded');
						setTimeout(function() { $.magnificPopup.proto.next.call(self); }, 120);
					}
					$.magnificPopup.instance.prev = function() {
						var self = this;
						self.wrap.removeClass('mfp-image-loaded');
						setTimeout(function() { $.magnificPopup.proto.prev.call(self); }, 120);
					}
				},
				imageLoadComplete: function() {
					var self = this;
					setTimeout(function() { self.wrap.addClass('mfp-image-loaded'); }, 16);
				}
			}
		});
	});


});
