Yahoo yui 和 iPad 方向
我刚刚开始为 iPad 开发一些类似 Web 应用程序的网站。我使用 YUI 的滚动视图来显示列表,效果很好。
现在的问题是,当方向改变时,我必须更新滚动器实例的高度,但我不知道如何完成。
据我所知,在我凌乱的代码中应该有一些侦听器和事件参数或其他东西。有什么想法吗?
YUI().use("scrollview", function (Y) {
if(window.orientation == 0) // Temp solution to set the right height on load.
{ var iheight = 740; }
else if(window.orientation == 90 || window.orientation == -90)
{ var iheight = 480; }
var scrollview = new Y.ScrollView({
id: "scrollview",
srcNode: '#scrollable',
height: iheight,
flick: {
minDistance:10,
minVelocity:0.3,
axis: "y"}
});
scrollview.render();
scrollView._uiDimensionsChange(); // Think I'm supposed to use this somehow.
});
I've just started developing some web application-like sites for iPad. I'm using YUI's scrollView for lists, which works nicely.
Now the problem is that when the orientation changes, I've got to update the scroller-instance's height, which I havn't got a clue how to accomplish.
As far sa I know, there should be some listeners and event args or something in my messy piece of code. Any ideas?
YUI().use("scrollview", function (Y) {
if(window.orientation == 0) // Temp solution to set the right height on load.
{ var iheight = 740; }
else if(window.orientation == 90 || window.orientation == -90)
{ var iheight = 480; }
var scrollview = new Y.ScrollView({
id: "scrollview",
srcNode: '#scrollable',
height: iheight,
flick: {
minDistance:10,
minVelocity:0.3,
axis: "y"}
});
scrollview.render();
scrollView._uiDimensionsChange(); // Think I'm supposed to use this somehow.
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要更改高度,您需要做的就是:
要在方向更改时执行该代码,这应该可以工作(尽管我无法测试它,因为我不在移动浏览器上) :
To change the height, all you need to do is this:
To execute that code when the orientation changes, this should work (though I can't test it since I'm not on a mobile browser):