HEX
Server: Apache
System: Linux webm010.cluster103.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: iestorre (46869)
PHP: 8.0.30
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/iestorre/www/templates/it_zen/assets/js/uncompressed/makefixed.js
/**
 * makefixed.js
 * @author Guilherme Augusto Madaleno <guimadaleno@me.com>
 * @version 1.0
 */

jQuery.fn.makeFixed = function (options)
{

	var sel = jQuery(this).selector;

	var el;
	var elc;
	var elAttr;

	var defOpts = 
	{
		defTopPos: '0px',
		defZIndex: 10000
	};

	/* MakeFixed attributes */

	var attr =
	{
		cIsFixed:  		'data-mfx-is-fixed',
		cPosition:  	'data-mfx-current-position',
		cLeft:      	'data-mfx-current-left',
		cTop:       	'data-mfx-current-top',
		cWidth:     	'data-mfx-current-width',
		cZIndex:    	'data-mfx-current-zindex',
		fLeft:      	'data-mfx-left',
		fTop:       	'data-mfx-top',
		fWidth:     	'data-mfx-width',
		fAtPos:     	'data-mfx-fix-at',
		fTopPos:    	'data-mfx-top-position'
	};

	/* To clean up attributes */

	var clearAttr = function (element)
	{
		jQuery(element).removeAttr
		(
			attr.fLeft + 
			' ' + attr.fWidth + 
			' ' + attr.cLeft + 
			' ' + attr.cTop + 
			' ' + attr.cWidth + 
			' ' + attr.cZIndex
		);
	};

	/* During scroll */

	jQuery(window).scroll(function(e)
	{

		/* We get the current scroll position */

		var scrolled = jQuery(window).scrollTop();

		/* For each element with the MakeFixed class */

		jQuery(sel).each(function()
		{

			el = jQuery(this);
			elc = this;

			/* Append attributes to element */

			if (!el.attr(attr.fLeft))
				el.attr(attr.fLeft, el.offset().left + 'px');

			if (!el.attr(attr.fWidth))
				el.attr(attr.fWidth, el.width() + 'px');

			if (!el.attr(attr.cPosition))
				el.attr(attr.cPosition, el.css('position'));

			if (!el.attr(attr.cLeft))
				el.attr(attr.cLeft, el.css('left'));

			if (!el.attr(attr.cTop))
				el.attr(attr.cTop, el.css('top'));

			if (!el.attr(attr.cWidth))
				el.attr(attr.cWidth, el.css('width'));

			if (!el.attr(attr.cZIndex))
				el.attr(attr.cZIndex, el.css('z-index'));

			if (!el.attr(attr.fAtPos))
				el.attr(attr.fAtPos, el.offset().top);

			/* Set element as fixed */

			if (el.attr(attr.fAtPos) <= scrolled)
			{

				el.attr(attr.cIsFixed, 1);

				el.css
				({
					// position:   'fixed',
					// left:       el.attr(attr.fLeft),
					// top:        (el.attr(attr.fTopPos)) ? el.attr(attr.fTopPos) + 'px' : defOpts.defTopPos,
					// width:      el.attr(attr.fWidth),
					// zIndex:     defOpts.defZIndex
				});

			}

			/* Set element back to it's normal state */

			else
			{

				el.attr(attr.cIsFixed, 0);

				el.css
				({
					// position:   el.attr(attr.cPosition),
					// left:       el.attr(attr.cLeft),
					// top:        el.attr(attr.cTop),
					// width:      el.attr(attr.cWidth),
					// zIndex:     el.attr(attr.cZIndex)
				});

				clearAttr(elc);

			}

			/* Callbacks */

			if (el.attr(attr.cIsFixed) == 1 && options && options.onFixed && typeof options.onFixed == 'function')
				options.onFixed (elc);	

			if (el.attr(attr.cIsFixed) == 0 && options && options.onUnFixed && typeof options.onUnFixed == 'function')
				options.onUnFixed (elc);	

			/* Reload values when the page orientation has changed */

			jQuery(window).off("orientationchange").on("orientationchange", function()
			{

				el.css
				({
					// position:   el.attr(attr.cPosition),
					// left:       el.attr(attr.cLeft),
					// top:        el.attr(attr.cTop),
					// width:      el.attr(attr.cWidth),
					// zIndex:     el.attr(attr.cZIndex)
				});

				clearAttr(elc);

			});

		});

	});

};