Jump to content
Search Community

krzysiekh

Members
  • Posts

    2
  • Joined

  • Last visited

krzysiekh's Achievements

0

Reputation

  1. @ZachSaucier thanks a lot! It worked like a charm. Here's a working code if anyone else will be in need: jQuery.fn.parallax = function(resistance, mouse) { $el = jQuery(this); TweenLite.to($el, 0.2, { x: -((mouse.clientX - window.innerWidth / 2) / resistance), y: -((mouse.clientY - window.innerHeight / 2) / resistance) }); }; jQuery(document).ready(function () { jQuery(document).mousemove(function(e) { jQuery(".ny-background").parallax(-30, e); jQuery(".ny-background-color").parallax(10, e); }); });
  2. Hi Guys! I have similar issue using image parallax with mouse interactions. I want to replicate this codepen https://codepen.io/oceaniclife/pen/JJbXod but in WordPress. So far I changed it like that, as I usually do with most scripts that don't want to work with WP: jQuery(document).ready.parallax = function(resistance, mouse) { $el = $(this); TweenLite.to($el, 0.2, { x: -((mouse.clientX - window.innerWidth / 2) / resistance), y: -((mouse.clientY - window.innerHeight / 2) / resistance) }); }; jQuery(document).ready(function () { jQuery(document).mousemove(function(e) { jQuery(".ny-background").parallax(-30, e); jQuery(".ny-background-color").parallax(10, e); }); }); However, I'm getting this error: script.js?ver=5.3.2:26 Uncaught TypeError: jQuery(...).parallax is not a function at HTMLDocument.<anonymous> (script.js?ver=5.3.2:26) Line 26 is jQuery(".ny-background").parallax(-30, e); I can't get it to work with WordPress and it drives me mad Any help will be appreciated.
×
×
  • Create New...