1
Ich habe an einem Projekt gearbeitet. Dies ist ein Maus Parallax Jquery Code. Im Moment haben die Elemente eine lineare Bewegung. Nach was ich suche ist, nachdem die Maus stoppt, muss die Bewegung für .2 Sekunden fortfahren. Kann mir jemand helfen? Ich habe dafür eine Skriptdatei parallax.min.js verwendet.Ich möchte einen Übergang zur Mausparallaxe hinzufügen
(function($) {
$.fn.extend({
jParallax: function(opt) {
var defaults = { moveFactor: 5, targetContainer: '#parallax' },
o = $.extend(defaults, opt);
return this.each(function() {
var background = $(this);
$(o.targetContainer).on('mousemove', function(e){
mouseX = e.pageX;
mouseY = e.pageY;
windowWidth = $(window).width();
windowHeight = $(window).height();
percentX = (0-((mouseX/windowWidth)*o.moveFactor) - (o.moveFactor/2)+o.moveFactor)/2;
percentY = (0-((mouseY/windowHeight)*o.moveFactor) - (o.moveFactor/2)+o.moveFactor)/2;
background[0].style.transform = "translate("+percentX+"%,"+percentY+"%)";
});
});
}
});
}(jQuery));
$('#img1').jParallax({ moveFactor: 5, targetContainer: '#parallax' });
$('#img2').jParallax({ moveFactor: 10, targetContainer: '#parallax' });
$('#img3').jParallax({ moveFactor: 15, targetContainer: '#parallax' });
$('#img4').jParallax({ moveFactor: 20, targetContainer: '#parallax' });
$('.main-nav').jParallax({ moveFactor: 0, targetContainer: '#parallax'});
$('.logo').jParallax({ moveFactor: 0, targetContainer: '#parallax'});
$('.main-banner-text').jParallax({ moveFactor: 0, targetContainer: '#parallax'});
$('.social-icons').jParallax({ moveFactor: 0, targetContainer: '#parallax'});
Und wie erwarten Sie uns zu sehen, was die Ausgabe ohne HTML ist, CSS? –