Question

I have implement jquery datepicker, Cufon script is also implemented on page. I have implemented some jquery on click events for "Next month", "Previous month" and on dates for Cufon.replace and Cufon.refresh. Problem what I am facing is that when page loads and if I click on next or prev button they work well until I click on any date. Whenever I click next or prev after clicking date an error displayed always in the place of month name stating that "undefined NaN". I am unable to understand that where is problem. If i remove the cufon it works well in all states.

Was it helpful?

Solution

The answer, then. Is to not use cufon. Now you are probably wondering... what about my super sweet sweet fonts?

Well, since cufon is a dirty abomination, you need a backup plan. That plan is the @ font-face proeprty. Here is a link to a fontface generator: http://www.fontsquirrel.com/fontface

This will generate a 'bulletproof' Css prop to allow you to use your fonts. Then,y ou just set the font family attribute in your jQuery UI theme, to alter the text.

Cufon needs to essentially 'scrape' the screen and do its ultra-stanky text-on-white-space-splitty-canvas-wrappy-magic. The statefulness, therefore as well as the ability of the datepicker to 'read itself' could be compromised. I understand you hooked up 'refresh' events.. but you actually dug into the widget and changed its html. If there are methods looking for certain jQuery nodes nodes in certain locations - they aren't there. Cufon rearranges, and nested them.

Go forth. Use @fontface. Eject cufon from your toolset forever. You shoudl be doing this anyways. Its a Css solution, so it will render very quickly and not interfere with your scripts. This is the preferred method.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top