如何在纵向视图中自动隐藏左侧滑块?

发布于 2024-11-19 07:01:50 字数 2356 浏览 3 评论 0原文

在我的应用程序中,我有两个滑块(左 30%/右 70%);当用户旋转平板电脑时,我想在纵向视图中隐藏左侧滑块。

是否可以?如果是的话怎么办?

enyo.kind({
    name: "dashboard",
    kind: enyo.VFlexBox,
    style: "background-color:#FFFFFF;",
    components: [

        {name: "header", kind: "Header", style: "background-color:#BDDEFF; height:57px;", layoutKind: "HFlexLayout", align: "start", components: [
            {kind: "ToolButtonGroup",style: "margin-right: 20px", components: [
                {icon: "images/menu-icon-refresh.png", className: "enyo-radiobutton-dark enyo-grouped-toolbutton-dark"},
                ]},

            {kind: "ToolButtonGroup", components: [

                {icon: "images/menu-icon-settings.png", className: "enyo-radiobutton-dark enyo-grouped-toolbutton-dark"},
                {icon: "images/menu-icon-edit.png", className: "enyo-radiobutton-dark enyo-grouped-toolbutton-dark"},
                {icon: "images/menu-icon-add.png", className: "enyo-radiobutton-dark enyo-grouped-toolbutton-dark", onclick: "addtask"},
            ]},

            {name: "vbutton", kind: "Button",style: "width:15%; margin-left: 20px; margin-top: 1px;", caption: "Hide Menu",onclick: "hidemenu"},

            {kind: "VFlexBox",style: "color:#5D5D5D; font-weight:bold;",  flex: 1, align: "center", components: [
                {content: "Business"},
                ]},
            //{content: "Business",className: "enyo-item-secondary" ,style: "color:#5D5D5D; font-weight:bold;"},

            {kind: "ToolButtonGroup", components: [
                {icon: "images/menu-icon-edit.png", className: "enyo-radiobutton-dark enyo-grouped-toolbutton-dark",onclick: "edittask"},
                {icon: "images/menu-icon-add.png", className: "enyo-radiobutton-dark enyo-grouped-toolbutton-dark",onclick: "addtasklist"},
                ]},

            {name: "title"},
            {name: "description", className: "enyo-item-secondary"}
        ]},
        {name: "slidingPane", kind: "SlidingPane", flex: 1, components: [

                    {name: "left", dismissible: true, onHide: "rightHide", onShow: "rightShow", onResize: "slidingResize", width: "250px", kind:"SlidingView", components: [

Menu/List
]},



            {name: "right",flex: 1, dismissible: false, onResize: "slidingResize",kind:"SlidingView", components: [

Menu related content

]},

],
});

In my application I have two sliders (left 30% / right 70%); I want to hide my left slider in portrait view, when the user rotates his tablet.

Is it possible? if yes then how?

enyo.kind({
    name: "dashboard",
    kind: enyo.VFlexBox,
    style: "background-color:#FFFFFF;",
    components: [

        {name: "header", kind: "Header", style: "background-color:#BDDEFF; height:57px;", layoutKind: "HFlexLayout", align: "start", components: [
            {kind: "ToolButtonGroup",style: "margin-right: 20px", components: [
                {icon: "images/menu-icon-refresh.png", className: "enyo-radiobutton-dark enyo-grouped-toolbutton-dark"},
                ]},

            {kind: "ToolButtonGroup", components: [

                {icon: "images/menu-icon-settings.png", className: "enyo-radiobutton-dark enyo-grouped-toolbutton-dark"},
                {icon: "images/menu-icon-edit.png", className: "enyo-radiobutton-dark enyo-grouped-toolbutton-dark"},
                {icon: "images/menu-icon-add.png", className: "enyo-radiobutton-dark enyo-grouped-toolbutton-dark", onclick: "addtask"},
            ]},

            {name: "vbutton", kind: "Button",style: "width:15%; margin-left: 20px; margin-top: 1px;", caption: "Hide Menu",onclick: "hidemenu"},

            {kind: "VFlexBox",style: "color:#5D5D5D; font-weight:bold;",  flex: 1, align: "center", components: [
                {content: "Business"},
                ]},
            //{content: "Business",className: "enyo-item-secondary" ,style: "color:#5D5D5D; font-weight:bold;"},

            {kind: "ToolButtonGroup", components: [
                {icon: "images/menu-icon-edit.png", className: "enyo-radiobutton-dark enyo-grouped-toolbutton-dark",onclick: "edittask"},
                {icon: "images/menu-icon-add.png", className: "enyo-radiobutton-dark enyo-grouped-toolbutton-dark",onclick: "addtasklist"},
                ]},

            {name: "title"},
            {name: "description", className: "enyo-item-secondary"}
        ]},
        {name: "slidingPane", kind: "SlidingPane", flex: 1, components: [

                    {name: "left", dismissible: true, onHide: "rightHide", onShow: "rightShow", onResize: "slidingResize", width: "250px", kind:"SlidingView", components: [

Menu/List
]},



            {name: "right",flex: 1, dismissible: false, onResize: "slidingResize",kind:"SlidingView", components: [

Menu related content

]},

],
});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧人九事 2024-11-26 07:01:50

首先将其添加到您的组件中:

{kind: "ApplicationEvents", onWindowRotated: "windowRotated"}

当窗口旋转时,将调用以下函数:

windowRotated: function(inSender) {
  if(enyo.getWindowOrientation() == "up"){
     this.$.left.setShowing(false);
  }
  else if(enyo.getWindowOrientation() == "left" OR enyo.getWindowOrientation() == "right"){
     this.$.left.setShowing(true);
  }

}

First add this to your components:

{kind: "ApplicationEvents", onWindowRotated: "windowRotated"}

When the window is rotated , the following function will be called:

windowRotated: function(inSender) {
  if(enyo.getWindowOrientation() == "up"){
     this.$.left.setShowing(false);
  }
  else if(enyo.getWindowOrientation() == "left" OR enyo.getWindowOrientation() == "right"){
     this.$.left.setShowing(true);
  }

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文