Skip to content

Instantly share code, notes, and snippets.

@muks999
Last active January 6, 2018 21:08
Show Gist options
  • Save muks999/0d702b1d3e215850218f56ccea94ad79 to your computer and use it in GitHub Desktop.
Save muks999/0d702b1d3e215850218f56ccea94ad79 to your computer and use it in GitHub Desktop.
jQuery Plugin Start
(function($) {
$.fn.myParallax = function(){
return this.each(function() {
var ths = $(this);
ths
.css({
"min-height" : "400px",
"position" : "relative",
"overflow" : "hidden"
})
.wrapInner("<div class='parallax-content' style='position:relative; z-index:1'>")
.prepend("<div class='image-parallax' style='background-image:url(" + ths.data('parallax-image') + "); background-size:cover; background-position:top; position:absolute; top=0; width:100%' >");
$(window).scroll(function() {
}).load(function() {
});
});
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment