Note that there are some explanatory texts on larger screens.

plurals
  1. PO.each yields correct class names for .hover call, but not for .css
    primarykey
    data
    text
    <p>I am trying to build a function that does an opacity fade for CSS objects (.thumbposition1 -> 20). I am dynamically assigning a background image the same CSS properties as its grayscale counterpart, which is being moused over (on a scroller).</p> <p>This works great when I manually specify each class by name, but when I try to minimize things by introducing an .each call, bad things happen: .hover works fine and returns the CSS class being moused over, but when I go to change (and test) the CSS properties of the overlying and underlying images, the offset values are always the same (top:0px,left:200px).</p> <p>What am I doing wrong? Please forgive any dumb mistake/hideous code/etc. I am a noob.</p> <pre><code>$(document).ready(function () { $("img").each(function(i) { var i = i + 1; var iString = i.toString(); var currentThumbPositionString_gs = ".thumbpositiongs" + iString; var currentThumbPositionString_c = ".thumbposition" + iString; var currentThumb_gs = $(currentThumbPositionString_gs); var currentThumb_c = $(currentThumbPositionString_c); var thumbPos = currentThumb_gs.offset(); var thumbPos_c = currentThumb_c.offset(); currentThumb_gs.hover(function() { currentThumb_c.css({ left:thumbPos.left, top:thumbPos.top, height:"auto", width:"auto", "z-index":"-1000000", visibility:"visible"}); currentThumb_gs.stop().animate({"opacity": "0"}, "1500"); }, function() { currentThumb_gs.stop().animate({"opacity": "1"}, "1500"); currentThumb_c.delay(355).queue( function() { $(currentThumb_c).css({ height:"0", width:"0", visibility:"hidden"}); currentThumb_c.clearQueue(); }); }); }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload