HEX
Server: Apache
System: Linux v38079.2is.nl 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: democfellows (10015)
PHP: 8.1.34
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/creativefellows.nl/olimazi.creativefellows.nl/public/js/app.js
$(document).foundation().ready(function(){
			
	$(".lazy-image, .lazy-load-image").Lazy({
		effect: "fadeIn",
		effectTime : 500,
		enableThrottle: true,
        throttle: 250,
		afterLoad: function(el){
			//console.log( el );
		//	el.parent().addClass("apics-shape__visible");
			el.showAltDescription();
		}
	});
	
	$("#header").fixednav();
	
	
	// cookie accept
	$('#acceptCookie').on("click",function(event)
	{
		event.preventDefault();

		var link = $(this).attr("data-link")
		$.ajax({
			type: 'POST',
			url: link,
			complete: function(){
				$("#accept-cookies").slideUp("fast");	
			}	
		});
	});
	
	
	$("#button-toggle").click(function(){
		$("header").toggleClass("header__navigation-open");
	});
	
	
	$(".jarallax").jarallax();
	
	
	$(".main-container .cell").each(function(i, el) {
	
		if ($(el).visible(true)) {
			$(el).addClass("already-visible"); 
	  	} 
	
	});	

	$(window).scroll(function(event) {

		$(".main-container .cell").each(function(i, el){
			if ($(el).visible(true)) {
				$(el).addClass("come-in"); 
			} 
		});
		
		$(".main-container .image").each(function(i, el){
			
			if ($(el).visible(true)) {
				$(el).addClass("animate");
			}
			
		});
		
	});
	
	setTimeout(function() { 
		$(".eapps-link").wrap('<div class="hide"></div>');
	}, 500);
		

});

$.fn.showAltDescription = function()
{
	
	return this.each(function(){

		var plugin 		= $(this);

		plugin.init = function()
		{	
			//var img = plugin.clone();
			if(!plugin.getAltText()) return;
							
			plugin.replaceWith('<figure class="image-alt-text"><div class="image"><img src="' + plugin.getImage() + '" alt="'+ plugin.getAltText() +'"></div><figcaption>' + plugin.getAltText() + '</figcaption></figure>');	
					
		}
		
		plugin.getImage = function(){
			return plugin.attr('src');
		}
		
		plugin.getAltText = function(){
			return plugin.attr("alt");
		}
			
		// init the plugin
	    plugin.init();
		
		
	});
}

/*
 * fixed navigation
 */
$.fn.fixednav = function()
{
	
	var shrinkHeader 	= $('#header').height();
	var lastScrollTop	 = 0;
	
	$(window).scroll(function() {

		var scrollYpos = getCurrentScroll();

		if(scrollYpos >= shrinkHeader) $('#header').addClass('has-scrolled');
		else $('#header').removeClass('has-scrolled');
		
		// scrolling up
		//if (scrollYpos < lastScrollTop) $('#header').removeClass('has-scrolled');
		 
		// set scroll pos
		lastScrollTop =  scrollYpos;
		
	});
	
	function getCurrentScroll()
	{
    	return window.pageYOffset;
    }
	
	function checkScrollPosition()
	{
		var scroll = getCurrentScroll();
		if(scroll >= shrinkHeader) $('#header').addClass('has-scrolled');
	}
	
	checkScrollPosition();	
	
}



$.fn.scrollSlideIn = function(){
	
	return this.each(function(){

		var plugin			= $(this);
		var current_scroll 	= 0;		
		
		var $section 		= plugin.closest(".page-section");
		
		var image_offset_y		= plugin.offset().top;
		var section_offset_y	= $section.offset().top;
		var section_height		= $section.outerHeight();

		
		plugin.init = function()
		{	

			$(window).scroll(function() {

				// set scroll
				plugin.setCurrentScroll();
			
				// section is in visible range
				if( $section.visible(true) )
				{
					plugin.transform();
				}
				
				
			});
			
		}
		
		plugin.transform = function()
		{
			
			var translateX = ((current_scroll - section_height) / section_height) * 100 * -1;
			
							
			plugin.css('transform','translateX('+ translateX +'%)');
		}
		
		plugin.setCurrentScroll = function()
		{
	    	current_scroll = (window.scrollY || window.pageYOffset);
	    }
	
			
		// init the plugin
	    plugin.init();
		
		
	});
}

$.fn.visible = function(partial) {

      var $t            = $(this),
          $w            = $(window),
          viewTop       = $w.scrollTop(),
          viewBottom    = viewTop + $w.height(),
          _top          = $t.offset().top,
          _bottom       = _top + $t.height(),
          compareTop    = partial === true ? _bottom : _top,
          compareBottom = partial === true ? _top : _bottom;

    return ((compareBottom <= viewBottom) && (compareTop >= viewTop));

};