Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>When you create the target value with:</p> <pre><code> var target = $$.css('backgroundImage').replace(/^url|[\(\)]|/g, ''); </code></pre> <p>The target value comes out wrapped in quotes ("). When the src attribute is then set, it is double quoted ""foo.jpg"" and thus is invalid HTML.</p> <p>Changing the above to:</p> <pre><code> var target = $$.css('backgroundImage').replace(/^url|[\(\)]|"/g, ''); </code></pre> <p>Will eliminate the extra quotes and should make it work...</p> <p><strong>Edit:</strong> Hmm, it worked for me, but I don't have an older firefox available... Perhaps it would be easier to work with just background urls...</p> <p>HTML:</p> <pre><code>&lt;div class="pic"&gt;&lt;div class="pic2"&gt;&lt;/div&gt;&lt;/div&gt; </code></pre> <p>CSS:</p> <pre><code>div.pic { position: relative; width:50px; height: 48px; background: url(http://static.jquery.com/ui/images/logo.gif); float:right; margin:3px 30px 0 0; } div.pic2 { position: absolute; top: 0; bottom: 0; left: 0; right: 0; background: url(http://static.jquery.com/files/rocker/images/btn_downloadLarge.gif); } </code></pre> <p>JS:</p> <pre><code>$.fn.crossfade = function(){ return this.each(function(){ var $$ = $(this).find('.pic2'); $$.hover(function(){ $$.stop().animate({opacity: 0}, 200); }, function(){ $$.stop().animate({opacity: 1}, 500); }, 0); }); } $("div.pic").crossfade(); </code></pre> <p>You can see a live example at jsfiddle: <a href="http://jsfiddle.net/MntuZ/1/" rel="nofollow noreferrer">http://jsfiddle.net/MntuZ/1/</a></p> <p>This works for me on FF3.6 and Chrome 5 (all I have access to on this computer.) This is assuming the example does what you're trying to do...</p>
    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. This table or related slice is empty.
    1. 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