文本动态更新后 Cufon 不显示
我目前正在使用 WP-ecommerce 插件在 WordPress 中构建一个电子商务网站。在产品页面中,库存会在您选择属性(尺寸、颜色等)后更新。它基本上显示产品是否有库存。页面加载时文本得到cufon,但是库存更新后,即选择一个属性,测试突然失去了cufon以及侧边栏中的小购物车。我不知道是什么导致了这个问题。您可以在这里查看该网站:http://tinyurl.com/43pd8br。感谢您的帮助!
I'm currently building an e-commerce site in wordpress using the WP-ecommerce plugin.In product page, the stock is updated after you select an attribute(size, color etc). It basically shows if the product is in stock or not. The text gets cufon when the page loads, but after the stock is updated, that is you select an attribute, the test suddenly loses cufon as well as the small shopping cart in the sidebar. I have no idea what is causing the problem. you can see the site here : http://tinyurl.com/43pd8br . Thanks for helping!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
文本更新后,您需要再次调用 cufon。与 CSS 不同,CSS 将样式应用于当前和未来页面与选择器匹配的任何元素,Cufon 是 JS,这意味着它响应事件。
当您第一次加载页面时,您正在应用 cufon - 因此它会找到所有匹配的元素并执行其操作,然后就完成了。当您在没有页面加载的情况下更新文本时,cufon 不会意识到这一点 - 据了解,它已经完成了它的工作并且已经完成。
因此,您需要做的是回调 - 在动态更新文本的脚本中,在更新发生后添加 cufon 操作。
You'll need to call cufon again after the text is updated. Unlike CSS, which applies a style to any element matching the selector now and in the future of the page, Cufon is JS, meaning it responds to events.
When you first load your page, you are applying cufon - so it goes and finds all the matched elements and does its thing, then it's done. When you update your text without a page load, cufon is not aware of this - as far as knows, it's done its job and has finished.
So what you need to do is a callback - in the script that dynamically updates your text, add your cufon actions once the update has happened.