0

I have a website where I want to use MagicZoom. Everything would be fine since it is easy to implement, but there seems to be an error when loading the js file.

I will send you the website which is currently under construction. MagicZoom should be implemented there, where you chose your fabric, for a close-up.

I think, but of course this is only my opinion and I'm not an expert, that the problem occurs because the div container with the picture is created dynamically from another PHP file and not present onload. Therefore the JavaScript does not work properly.

You will see that in the second step the zoom does not load although the class is set correctly.

Taryn East
  • 27,486
  • 9
  • 86
  • 108
Aaron71
  • 3
  • 2

1 Answers1

1

Your error says "prettyPhoto is not a function". This tells me that some script is trying to use the "prettyPhoto" object before that script has been included on the page.

Looking at your HTML header, I see that is among the last of the <script> tags. Try moving the <script> tag where you include that library in your HTML header up a couple of lines, above some of the other includes. Be aware - you can't move it above the includes for jQuery!

Try that out, let us know.

Chris Baker
  • 49,926
  • 12
  • 96
  • 115
  • When I advance to the second step, the script now appears to be performing as desired. – Chris Baker Feb 14 '11 at 20:01
  • Can you explain further? For me the zoom does not work as desired. Maybe you can pasted the corrected code in here? Would be wonderful. thanks Chirs! – Aaron71 Feb 14 '11 at 20:24
  • What I am saying is that when I go to the site, click to the next step, I can click the samples and it shows a larger version. There isn't any corrected code - yours works for me in Firefox 3.6. What browser are YOU using? – Chris Baker Feb 14 '11 at 20:26
  • Im using FF3.6 also and Safari but the point is not that Chirs, it only shows a lager pic not a zoomed one. – Aaron71 Feb 14 '11 at 20:28
  • Ah, I see what you're saying. You would have to add some code in the callback function after adding the response from calling to `detail_fabric.php`. According to the documentation for MagicZoom, you should call `MagicZoom.refresh()` at that point. – Chris Baker Feb 14 '11 at 20:34
  • Great Chris that you figured it out, but excuse me since I'm a noob at this point, you are talking in riddles. I would be happy if you could help me for a coffee I'm dying here.. – Aaron71 Feb 14 '11 at 20:40
  • You do owe me a coffee... after digging all over the place through the script files included on your site, I found the proper script: quote.js. Find the function that starts with the text "function show_detail_fabric(result_data3){". At the bottom of that function (before the first "}" after the text I indicated above), add the code `MagicZoom.refresh()`. – Chris Baker Feb 14 '11 at 20:49
  • Be sure to accept the answer if it works out... click the big green checkmark here to the left. If you leave answers "unaccepted", people will become less and less willing to help. :) – Chris Baker Feb 14 '11 at 20:50
  • Thank you Chris! You are more then welcome once we have opened. If you ever need a bespoke suit don't hesitate. I mean it. Aaron :) – Aaron71 Feb 14 '11 at 21:07
  • Can I ask.... who set most of that stuff up for you? Do you have a web developer, or are you trying to do it all on your own? The reason I ask is that things are getting kind of messy over there - if you have a developer, I would suggest you not do so much self-tweaking. If you DON'T have a developer, I suggest you get one to give your page a once-over before you go live and start inviting customers to it! :) – Chris Baker Feb 14 '11 at 21:10
  • I would be very happy to talk to you Chirs :) You can use the contact form to send me a message with your skype no if you like and we can discuss from here since I had the same thoughts with the facelift of the code. – Aaron71 Feb 14 '11 at 21:24