Answered

Change Image with Jquery? setElementParameters works with text

How can I replace an initial image with jquery? I was able to change text with fancyProductDesigner.setElementParameters({text:"hello world"},"title"); however when I try to change image type and change the "source" parameter nothing is changed.  Can someone help me understand which parameter I need to change so that the canvas image source is swapped out?

  • Just to answer my own question, the new image needs to be added as a replacement.

  • I am trying to accomplish both of these things you mentioned, but I'm not having any luck. Are you using the Wordpress version?


    Would you mind sharing a bit of your code? I've tried using this code in the footer of my site, but it doesn't work:

    fancyProductDesigner.setElementParameters({text:"hello world"},"firstdate");



  • i am have this problem too, fancyProductDesigner.setElementParameters do anithing and don't change image.


    p.s.

    i try use this for changing boundingbox (transparancy image), for example i need to change boundingbox size on t-shirt print like A5, A4, A3 and change proper price for this format. Change price are work ok, but when i try to change img, nothing happens.

  • Hello DP4,

    have you got simple example for me, how will be work´s?

    I try to change the source-parameter in jQuery like this:


    $(this).find('picture').on('click', function(evt) {

        var imagePath = $(this).attr("data-img");

        if(typeof(yourDesigner.getElementByTitle('NewImage')) !== 'undefined' ) {

            yourDesigner.replace = imagePath;

        }

    });


    thank´s for up :)

  • Ok, I solved the issue myself.

    $(this).find('picture').on('click', function(evt) {

        var imagePath = $(this).attr("data-img");

        if(typeof(yourDesigner.getElementByTitle('NewImage')) !== 'undefined' ) {

            yourDesigner.addCustomImage(imagePath, 'NewImage'); 

        }

    });


    thx.

Login or Signup to post a comment