1

I have been working on some jQuery in jsfiddle and I currently have it working. However, when I apply the exact same script to my Expresso Store using EE it doesn't work. It's not outputting in js errors in Firebug. Any ideas?

Here is the fiddle http://jsfiddle.net/NnEdM/11/

And here is my site http://spartonenterprises.com/store/playground-mulch

6
  • I can see that in your page, you have two versions of jQuery: <script type="text/javascript" src="ajax.googleapis.com/ajax/libs/jquery/1.7/…> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> Does Firebug generate errors when there's a conflict? Could that be the problem - that the code doesn't know which version of jQuery to call? (Though I tried versions 1.7, 1.8 and 1.9 in JSFiddle. They all worked. So maybe that isn't it...)
    – user800
    Commented Apr 6, 2013 at 14:29
  • I'm pretty sure, yet not positive, you can use jQuery and jQueryUI in the same document. At least I've never had any issues in the past. I suspect it's a function within Expresso Store that's conflicting. a("form.store_product_form").delegate('[name^="modifiers"]:not(:radio)', "change", e) possibly? Basically what I'm attempting to do is combine three functions on .hover. One to change the thumbnail, change the SKU and change the option value. Commented Apr 6, 2013 at 15:10
  • Gah - sorry. Not caffeinated enough, didn't register that that was jQuery and a jQuery UI. And yes, I think that's correct, you can use jQuery and jQuery UI in the same doc. I thought I saw calls to two different versions of jQuery itself. (Which is possible to do...but can sometimes cause conflicts.)
    – user800
    Commented Apr 6, 2013 at 15:44
  • Well, 6 hours later I managed to get this sorted out. The problem was a css issue believe it or not. Thanks for the input! Commented Apr 7, 2013 at 12:34
  • Isn't that always the way? It's a minor CSS syntax, or a space in an item name. (That particular bugbear got me last week. Everything was totally fine...but there was a space in front of a notification-template name, which meant that the form was trying to use a nonexistent template.) Glad you got it figured out!
    – user800
    Commented Apr 7, 2013 at 14:02

1 Answer 1

3

This may not be the prettiest solution but, I got it working by removing the inline float:left and adding it to my css instead. Just to pass along, I wrote this jQuery to add mouse over functionality to swap product images, change the value of my select modifier, change the SKU and price on thumbnail mouseover.

 $(document).ready(function () {

        $('#fandeck #18 a').hover(function () {
           $(this).css('cursor','hand');
        $('.group').hide();
        $('#43').show();
            $('#selectImg').val('44').prop('selected', 'selected');
            $("#43 img").attr("src", "/images/uploads/Playground_Mulch_BLK.png")
          $('.store_product_sku').text('90509');
          $('.store_product_price').text('$7.50');

          }); 



        $('#fandeck #19 a').hover(function () {
           $(this).css('cursor','hand');
        $('.group').hide();
        $('#43').show();
            $('#selectImg').val('44').prop('selected', 'selected');
            $("#43 img").attr("src", "/images/uploads/Playground_Mulch_RD.png").fadeIn("slow");
          $('.store_product_sku').text('90509RD');
          $('.store_product_price').text('$18.00');
        });


        $('#fandeck #20 a').hover(function () {
           $(this).css('cursor','hand');
        $('.group').hide();
        $('#43').show();
            $('#selectImg').val('45').prop('selected', 'selected');
            $("#43 img").attr("src", "/images/uploads/Playground_Mulch_BRN.png").fadeIn("slow");
          $('.store_product_sku').text('90509BR');
           $('.store_product_price').text('$18.00');
        });


        $('#fandeck #21 a').hover(function () {
        $('.group').hide();
        $('#43').show();
            $('#selectImg').val('46').prop('selected', 'selected');
            $("#43 img").attr("src", "/images/uploads/Playground_Mulch_GN.png").fadeIn("slow");
          $('.store_product_sku').text('90509GN');
           $('.store_product_price').text('$18.00');
        });


        $('#fandeck #22 a').hover(function () {
        $('.group').hide();
        $('#43').show();
            $('#selectImg option[value=47]').prop('selected', 'selected');
            $("#43 img").attr("src", "/images/uploads/Playground_Mulch_BL.png").fadeIn("slow");
          $('.store_product_sku').text('90509BL');
           $('.store_product_price').text('$18.00');

       })
});

       //Image replacement for Playground Much Select
        $('.group').hide();
        $('#43').show();
        $('#selectImg').change(function () {
          var num = 43;
            $('.group').hide();
            $('#' + $(this).val()).show();
          if($(this).val()==num){ // Resets to Black if mouse over has changed source
            $("#43 img").attr("src", "/images/uploads/Playground_Mulch_BLK.png")    
        }
        })

Here is the final jsfiddle and here's final result. http://spartonenterprises.com/store/playground-mulch

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.