سؤال

I am trying to draw 2 arrows on canvas elements and place them on the left and right of the screen, in the middle of its height. Fiddle here: http://jsfiddle.net/Wzt5j/9/

In the site i am trying this ( http://bit.ly/JV5I0Z ), the images are drawn but the "placeArrows" function does not get called when i resize the window. In the fiddle window they aren't even drawn and i'm not sure what is the problem.

هل كانت مفيدة؟

المحلول

You have JS errors during resize. thumdList (line 150) and marginDiv (line 156) are null.

This stops your script.

نصائح أخرى

The reason for the fiddle not working is because JSFiddle is stupid. The functions you define are only defined inside its wrapper function, and so can't be accessed by anything else. Solve this pain in the arse by declaring your functions as myfunction = function() {...}.

As for the failing to resize, I don't see any code that listens for onresize. Add this: window.onresize = placeArrows;.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top