开发者

CSS not being added correctly in JQM Templates

I'm working on a JQuery Mobile project and I've recently changed the way some data was displayed to use Templates (I was sending them as a string of HTML). The problem comes from the CSS not being added correctly to the classes... sometimes. It happens more often in chrome than it does in firefox, so my guess is that it has something to do with the page loading before the CSS has a chance to be added.

Because the project is set up so that the 'pages' are divs that are hidden and shown one at a time for this part, reloading/refreshing normally doesn't fix the problem. The best way I can think of to make sure the information is loaded correctly is to somehow load the CSS to the classes after the data has been passed.

Some more information about how the project is set up. There is a main page that is used for the basic navigation (main.html then you click a link and it takes you to main.html#DataPage). When you click the links to go between pages, there are usually calls to another backend program that actually retrieves the data, then sends it to the page in json format. A script takes that data and puts it into a template then puts it into a div on the page. The classes that need to get the CSS are in the template (in s if it matters). There is a hardcoded templat开发者_如何学编程e for the IT desk that has always worked, it is the small data set that was recently changed to using templates that doesn't get its CSS properly.

Any help or suggestions would be appreciated.


A coworker pointed out how to fix the problem. Added another class to the template and the used

$('.newClass').listview()

Always fun to dig through mountains of documentation and somehow miss the one class that would fix the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜