简体   繁体   English

基础自定义操作表

[英]Foundation Custom Action Sheet

I am new to Foundation for App and SASS. 我是App和SASS基金会的新手。

I am trying to create a custom action sheet that makes use of the sass mixin to custom style it without affecting the base foundation scss as shown in here. 我正在尝试创建一个自定义操作表,该表使用sass mixin自定义样式,而不影响此处显示的基础基础scss。 http://foundation.zurb.com/apps/docs/#!/action-sheet http://foundation.zurb.com/apps/docs/#!/action-sheet

The app I want to create needs to be responsive, and it will be used on a web browser on a computer. 我要创建的应用程序需要响应,并且将在计算机上的Web浏览器中使用。

The action sheet style that I want to customise is to remove the tail of the action sheet as well as adding custom elements within. 我要自定义的操作表样式是删除操作表的尾部以及在其中添加自定义元素。 However with my current implementation, the action sheet keeps appearing from the bottom (like it should in a small screen) instead of from the origin (as it should in a medium screen size or above). 但是,在我当前的实现中,操作表始终从底部出现(就像它应该在小屏幕上显示),而不是从原点开始出现(因为它应该在中等屏幕尺寸或以上)出现。 The tail is also still there despite me altering the variable $tail-size. 尽管我更改了变量$ tail-size,但是尾巴也仍然存在。

I am suspecting that I am implementing it wrongly in the html file and thus I ask for guidance. 我怀疑我在html文件中错误地实现了它,因此我要求提供指导。

Below is my current code which is not working. 下面是我当前的代码不起作用。

my app.scss 我的app.scss

 // This is the wrapper for your button and action sheet
.sign-in-box-container {
  position: relative;
  display: inline-block;
}
// This is the action sheet itself
.sign-in-box {
  // These are the core styles for the sheet menu
  $padding: 1rem;
  $color: #000;
  // $border-color;
  $background-hover: #ccc;
  $tail-size: 0;

  // This mixin sets up styles for the mobile action sheet
  @include action-sheet(
    $position: bottom, // Can be top or bottom
    $shadow: 0 3px 10px black,
    $animate: transform opacity, // Properties to animate when the menu is shown and hidden. Remove "transform" or "opacity" to turn off those animations
    $animation-speed: 0.25s, // Speed at which the menu animates in and out
    $padding: 0.5rem,
    $background: #fff // Background color
  );
  // This mixin sets up styles for the desktop popup menu
  // Here we're only applying the styles on medium-sized screens and larger
  @include breakpoint(medium)
  {
    $position: bottom; // Can be top or bottom
    $background: #fff; // Background color
    $width: 200px; // Width of whole menu
    $radius: 3px; // Border radius of menu
    $shadow: 0 4px 10px black; // Box shadow of menu
    $tail-size: 0; // Size of tail that is attached to the menu
  }
}

my index.html 我的index.html

<zf-action-sheet class="sign-in-box-container">
   <zf-as-button><a>Sign In Here</a></zf-as-button>
   <zf-as-content class="sign-in-box">
     <p> Bla bla bla </p>
   </zf-as-content>

For Ref: Foundation Doc 供参考: Foundation Doc

You can simply in your file foundation_and_overrides.scss (or similar name) created by Foundation you can change this var: 您可以简单地在Foundation创建的文件foundation_and_overrides.scss(或类似名称)中更改此变量:

$actionsheet-tail-size: 10px;

to 0. This will change it globally; 为0。这将全局更改它; otherwise, just override that specific style for that specific class 否则,只需为该特定类覆盖该特定样式

.sign-in-box-container::before, 
.sign-in-box-container::after { border: 0; }

Probalby you will need further styles in order to place the box closer to the trigger if needed Probalby,您将需要更多的样式,以便在需要时将盒子放置在靠近触发器的位置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM