You have extra ); in your second anonymous function. This code worked for me:

$(document).ready(function() {
     var source2 = $("div.listingimagetwo img").attr("src");
     var source1 = $("div.listingimageone img").attr("src");

     $(".listingimagetwo").hover(
           function () {
               $("div.listingimage img").attr("src", source2);
           },
           function(){
               $("div.listingimage img").attr("src", source1);
           }
           );
     });

----
Read jQuery HowTo Resource  -  http://jquery-howto.blogspot.com



On Tue, Feb 24, 2009 at 9:41 AM, drm <d...@deanmyerson.org> wrote:
>
> See http://dev.slyd.us/drupal/foundation/node/59
>
> I want to have a mouseover of one of the small images make it replace
> the larger one. This is what I'm trying:
>
> '$(document).ready(function() {
>      var source2 = $("div.listingimagetwo img").attr("src");
>      var source1 = $("div.listingimageone img").attr("src");
>
>      $(".listingimagetwo").hover(
>            function () {
>                $("div.listingimage img").attr("src", source2);
>            },
>            function(){
>                $("div.listingimage img").attr("src", source1);
>                );
>            }
>      });
>
> I also tried using div.listingimagetwo[img] instead of
> div.listingimagetwo img
>
> Is there a plugin that you do this?
>
> The site also uses thickbox to display these images. Does that
> conflict? I was brought on to add this function, so I can't change the
> html structure, though I could ask the client if need be.
>
> Thanks for any pointers.
>

Reply via email to