【问题标题】:Zurb Foundation 5 - making buttons responsiveZurb Foundation 5 - 使按钮响应
【发布时间】:2023-04-01 10:04:01
【问题描述】:

在 Zurb Foundation 5 - 当浏览器被调整为更小或在更小的屏幕上时,如何响应地切换到更小的按钮样式?

在 StackOverFlow 上提出并回答了类似的问题 here 但正确的解决方案不适用于 Foundation 5,猜测它仅适用于 Foundation 4。 p>

当调整到较小的屏幕时,按钮当前看起来像这样 ($button-lrg):

但我希望按钮在调整到更小的屏幕时看起来更像这样 ($button-sml):

任何帮助将不胜感激!


我根据上面类似问题链接的正确答案想出了一个 sass/scss mixin。只需将以下 mixin 添加到您的“app.scss”文件中:

@media #{$small-up} { 
    .responsive-button {
        @include button($button-sml, $primary-color, 0px, false, false, false); 
    }
}

@media #{$medium-up} {
    .responsive-button {
        @include button($button-lrg, $primary-color, 0px, false, false, false); 
    }   
}

【问题讨论】:

    标签: button sass zurb-foundation


    【解决方案1】:

    你可以通过visibility classes实现它:

    <div class="show-for-medium-up">
        <a href="#" class="button large alert">Button 1 </a>
        <a href="#" class="button large ">Button 2</a>
    </div>
    <div class="hide-for-medium-up">
        <a href="#" class="button tiny  alert">Button 1 </a>
        <a href="#" class="button tiny ">Button 2</a>
    </div>
    

    http://jsfiddle.net/Ltamvrc7/

    基金会开发人员在他们的网站上使用了这种技术。

    【讨论】:

    • 很棒的解决方案 JAre!谢谢!我根据我的问题中类似的先前 StackOverFlow 问题链接提出了一个混合解决方案,我将在我的问题中添加它作为解决方案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-11-29
    • 2014-01-01
    • 2013-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-14
    相关资源
    最近更新 更多