<commit_before>/* simpParallax - <NAME> -  https://github.com/arthurcamara1/simpParallax */

(function ($) {
 
    $.fn.simpParallax = function(options) {

    	var defaults = {
    		factor: 0.2,
    		parallaxtype: 'top'
    	};

    	var settings = $.extend( defaults, options );
    	var scrolledY = $(window).scrollTop();

    	if(settings.parallaxtype === "background") {
    		this.css("background-position","center -"+((scrolledY*settings.factor))+"px");
    	} else {
    		this.css(settings.scrollType,"-"+((scrolledY*settings.factor))+"px");
    	}
        return this;
    };

    $.simpParallax = function() {

        $(window).bind("scroll",function(e){
        
            $("[data-parallax='true']").each(function() {
                //set options according to data attributes
                var options = {};
                var attrs = ["factor", "parallaxtype"];
                for(var i=0, size=attrs.length; i<size; i++) {
                    var attribute = attrs[i];
                    if($(this).attr("data-"+attribute)) {
                        options[attribute] = $(this).data(attribute);
                    }
                }
                $(this).simpParallax(options);
            });

        });

    }
 
}(jQuery));<commit_msg>Fixes the parallax effect<commit_after>/* simpParallax - <NAME> -  https://github.com/arthurcamara1/simpParallax 

-----------------------------------------
Usage:

<script>
    $("#my_element").simpParallax({
        factor: 0.5,
        parallaxtype: 'background'
    });
</script>

OR

<div id="element" data-parallax="true" data-factor="0.3" data-parallaxtype="top"></div>
<script>
    $.simpParallax();
</script>

-----------------------------------------
*/

(function ($) {
 
    $.fn.simpParallax = function(options) {

        var defaults = {
            factor: 0.5,
            parallaxtype: 'top'
        };

        var settings = $.extend( defaults, options );
        var scrolledY = $(window).scrollTop();

        if(settings.parallaxtype === "background") {
            this.css("background-position","center -"+((scrolledY*settings.factor))+"px");
        } else {

            var top;
            if ($.isNumeric(this.attr('data-initialpos'))) {
                top = this.attr('data-initialpos');
            } else {
                top = parseInt(this.css('top'),10);
                this.attr('data-initialpos', top);
            }

            var position = (top-(scrolledY*settings.factor));

            this.css(settings.parallaxtype,position+"px");
        }
        return this;
    };

    $.simpParallax = function() {

        $("[data-parallax='true']").each(function() {
            if (!$(this).attr('data-parallaxtype')) {
                $(this).attr('data-parallaxtype', 'top');
            }
            if (!$(this).attr('data-factor')) {
                $(this).attr('data-factor', 0.5);
            }
        });

        $(window).bind("scroll",function(e){
        
            $("[data-parallax='true']").each(function() {
                //set options according to data attributes
                var options = {};
                var attrs = ["factor", "parallaxtype"];
                for(var i=0, size=attrs.length; i<size; i++) {
                    var attribute = attrs[i];
                    if($(this).attr("data-"+attribute)) {
                        options[attribute] = $(this).attr("data-"+attribute)
                    }
                }
                $(this).simpParallax(options);
            });

        });

    }
 
}(jQuery));
{'fraction_non_alphanumeric': 0.19266311957434892, 'fraction_numerical': 0.004480537664519743, 'mean_word_length': 1.6284032376747608, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5976143', 'n_tokens_mistral': 1081, 'n_tokens_neox': 1034, 'n_words': 158}