Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The second anonymous function you created cannot see the performer var, it is not in the scope chain. You must put it outside like this:</p> <pre><code>$('.photo').each(function() { // All of the .photo divs.... var performer = $(this).attr("rel"); $(this).hoverIntent(function() { // The second function can't see in here $(this).html('&lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,24,0" width="250" height="250"&gt;&lt;param name="movie" value="http://static.awempire.com/flash/live_feeds/live_feed.swf" /&gt;&lt;param name="quality" value="high" /&gt;&lt;param name="wmode" value="transparent" /&gt;&lt;param name="flashvars" value="appletroot=http://static.awempire.com/flash/live_feeds/&amp;appletskin=template8/template01.swf&amp;appletcol=900000&amp;psid=ddany23&amp;campaign_id=20520&amp;pstour=t1&amp;psprogram=REVS&amp;site=jsm&amp;flags=137438953473,137438953504,1,32&amp;lp_lang=auto" /&gt;&lt;embed src="http://static.awempire.com/flash/live_feeds/live_feed.swf" width="250" height="250" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" flashvars="appletroot=http://static.awempire.com/flash/live_feeds/&amp;appletskin=template8/template01.swf&amp;appletcol=900000&amp;psid=ddany23&amp;campaign_id=20520&amp;pstour=t1&amp;psprogram=REVS&amp;site=jsm&amp;flags=137438953473,137438953504,1,32&amp;lp_lang=auto"&gt;&lt;/embed&gt;&lt;/object&gt;'); }, function() { $(this).html(''+performer+''); }); }); </code></pre> <p>If you don't know why, i would suggest learning more about closures in javascript.</p> <hr> <h2>Edit</h2> <p>Sorry, didn't know there were duplicates...</p> <p>Use each to iterate through each and create a variable for every .photo, then that varaible can be referenced by the anonymous functions created.</p> <hr> <h2>Edit</h2> <p>Also i don't see why you didn't just take your original code and do this:</p> <pre><code>$(this).hoverIntent(function() { $(this).html('&lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,24,0" width="250" height="250"&gt;&lt;param name="movie" value="http://static.awempire.com/flash/live_feeds/live_feed.swf" /&gt;&lt;param name="quality" value="high" /&gt;&lt;param name="wmode" value="transparent" /&gt;&lt;param name="flashvars" value="appletroot=http://static.awempire.com/flash/live_feeds/&amp;appletskin=template8/template01.swf&amp;appletcol=900000&amp;psid=ddany23&amp;campaign_id=20520&amp;pstour=t1&amp;psprogram=REVS&amp;site=jsm&amp;flags=137438953473,137438953504,1,32&amp;lp_lang=auto" /&gt;&lt;embed src="http://static.awempire.com/flash/live_feeds/live_feed.swf" width="250" height="250" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" flashvars="appletroot=http://static.awempire.com/flash/live_feeds/&amp;appletskin=template8/template01.swf&amp;appletcol=900000&amp;psid=ddany23&amp;campaign_id=20520&amp;pstour=t1&amp;psprogram=REVS&amp;site=jsm&amp;flags=137438953473,137438953504,1,32&amp;lp_lang=auto"&gt;&lt;/embed&gt;&lt;/object&gt;'); }, function() { $(this).html('' + $(this).attr("rel") + ''); }); </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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