【问题标题】:Navicon Transformicons blue borderNavicon Transformicons 蓝色边框
【发布时间】:2014-03-18 12:24:51
【问题描述】:

我在玩sara soueidannavicon,分析后还是有些不太明白。

我似乎无法删除的那些图标周围有一个蓝色选择器,是他的方法特有的还是对jquery的简单误解?

这里是代码http://jsfiddle.net/Ah6XA/

    <button type="button" role="button" aria-label="Toggle Navigation" id="mbtn" class="lines-button x">
      <span class="lines"></span>
    </button>
#mbtn {
      display: inline-block;
      margin: 0 1em;
      border: none;
      background: none;
    }
    #mbtn span {
      display: block;
    }

    .lines-button {
      padding: 2rem 1rem;
      transition: .3s;
      cursor: pointer;
      /* */
    }

    .lines {
      display: inline-block;
      width: 4rem;
      height: 0.57143rem;
      background: #211f20;
      border-radius: 0.28571rem;
      transition: 0.3s;
      position: relative;
    }
    .lines:before, .lines:after {
      display: inline-block;
      width: 4rem;
      height: 0.57143rem;
      background: #211f20;
      border-radius: 0.28571rem;
      transition: 0.3s;
      position: absolute;
      left: 0;
      content: '';
      -webkit-transform-origin: 0.28571rem center;
      transform-origin: 0.28571rem center;
    }
    .lines:before {
      top: 1rem;
    }
    .lines:after {
      top: -1rem;
    }

    .lines-button:hover .lines:before {
      top: 1.14286rem;
    }
    .lines-button:hover .lines:after {
      top: -1.14286rem;
    }

    .lines-button.close {
      -webkit-transform: scale3d(0.8, 0.8, 0.8);
      transform: scale3d(0.8, 0.8, 0.8);
    }

    .lines-button.x.close .lines {
      background: transparent;
    }
    .lines-button.x.close .lines:before, .lines-button.x.close .lines:after {
      -webkit-transform-origin: 50% 50%;
      transform-origin: 50% 50%;
      top: 0;
      width: 4rem;
    }
    .lines-button.x.close .lines:before {
      -webkit-transform: rotate3d(0, 0, 1, 45deg);
      transform: rotate3d(0, 0, 1, 45deg);
    }
    .lines-button.x.close .lines:after {
      -webkit-transform: rotate3d(0, 0, 1, -45deg);
      transform: rotate3d(0, 0, 1, -45deg);
    }



var anchor = document.querySelectorAll('button');

[].forEach.call(anchor, function(anchor){
  var open = false;
  anchor.onclick = function(event){
    event.preventDefault();
    if(!open){
      this.classList.add('close');
      open = true;
    }
    else{
      this.classList.remove('close');
      open = false;
    }
  }
}); 

【问题讨论】:

  • 我猜这只是网络浏览器添加的选择/焦点矩形,就像您单击常规链接或关注表单字段时一样。很容易摆脱:stackoverflow.com/questions/179510/…
  • 正是,非常感谢!

标签: jquery html css icons transform


【解决方案1】:

如果你想在手机上去掉边框,你必须添加这个:

-webkit-tap-highlight-color: rgba(0, 0, 0, 0);

【讨论】:

    猜你喜欢
    • 2015-05-17
    • 1970-01-01
    • 2013-05-14
    • 2012-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-02
    • 2013-09-21
    相关资源
    最近更新 更多