javascript - jQuery on mouse move target selects all similar elements -


I have (for example) 6 elements, with all the same classes and different materials, they all have backgrounds too. Which are a bit zoomed in. Depending on them, their background is required while moving the mouse. My problem - Once when I hover on a single element then all the backgrounds go any help?
This is my code:

HTML (of one element):

  & lt; A href = "/" class = "project" style = "background-image: url ('link_to_image');" & Gt; & Lt; P & gt; Project & lt; / P & gt; & Lt; Span & gt; Details & lt; / Span & gt; & Lt; / A & gt;  

CSS (again, single element):

  .project {status: relative; Display: Inline-block; Margins: 10px; Height: 400 pixels; Width: 400px; Background: #bcc; Color: #fff; Text-decoration: None; Box-shadow: Inset 0 px 0 r px rgba (0,0,0,0,0,0), inset 0 px-50px 100px -40px rgba (0,0,0,0.6); Transition: Box-Shadow.5S Easy-In-Out; Hidden flurry; Swim left; White-space: Initial; Background-position: center; Background size: cover; Repeat Background: No Repetition; } .project p {position: absolute; Bottom: 2%; Left: 2%; Font-size: 40px; Font-family: "Josephine slab"; font-weight: bold; Infections: all easily .46; Transition-delay: .02s; Z-index: 1; }. Project period {display: block; Status: Completed; top 100%; Left: 2%; Font-size: 20px; Font-family: "ralve"; Infections: all easily .46; Transition-delay: .02s; Z-index: 1; } .Project: Hover Page {Down: 88%; } .Project: Hover span {top: 15%; }. Project: Hover {box-shadow: inset 0 px-30rem 0 px rgba (0,0,0,0.4.4); }  

js:

  $ ("project"). ("Mousemove", function (e) {x = (e.pageX - E.target.offsetLeft * 1.5) / 4; console.log (x); $ (". Project"). CSS ('background-position -x ', x +' px ');});  

use it !

  $ ("Project"). ("Mousemove", function (e) {x = (e.pageX - e.target.offsetLeft * 1.5) / 4; console.log (x); $ (this) .css ('background-position-x' , X + 'px'); // is the reference to "this." Project is going to be on AMM event.});  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -