无法使用iCheck选中复选框 - HTML复选框

问题描述 投票:1回答:1

我买了一个股票图像脚本,登录屏幕出现问题。有一个“记住我”选项,带有一个复选框。不幸的是,只有当你点击它会勾选方框时,才能点击复选框。我发现编码器使用icheck来创建按钮,但我不确定为什么你不能勾选复选框。

这是来源:

<div class="row margin-bottom-15">
    <div class="col-xs-7">
        <div class="checkbox icheck margin-zero">
            <label class="margin-zero">
                <input @if( old('remember') ) checked="checked" @endif id="keep_login" class="no-show" name="remember" type="checkbox" value="1">
                <span class="keep-login-title">{{ trans('auth.remember_me') }}</span>
        </label>
    </div>
</div>

Javascript部分

<script src="{{ asset('public/plugins/iCheck/icheck.min.js') }}"></script>
<script type="text/javascript">
  $(document).ready(function(){
      $('input').iCheck({
        checkboxClass: 'icheckbox_square-red',
        radioClass: 'iradio_square-red',
        increaseArea: '20%' // optional
      });
    });
</script>

这是现场示例中的网站:http://gostock.miguelvasquez.net/login有人知道如何解决这个问题吗?

javascript html html5 checkbox icheck
1个回答
1
投票

好吧,我要看看你的iCheck功能,同时你可以用css解决你的问题:

.keep-login-title{
  position: absolute;
  left: 0;
  top: 50%;
  padding-left: 26px;
  transform: translate(0, -50%);
  white-space: nowrap; 
}

那么iCheck工作正常,你的问题纯粹是css,你的输入有错误,它不应该在你的主复选框前面绘制,重定向每个用户的动作,如onClick事件:

只需添加:

//you already have a .no-show class, i guess the author only forget the z-index 'thing'
.no-show{
  z-index: -1
}

如果您想了解更多关于z-index的信息

© www.soinside.com 2019 - 2024. All rights reserved.