实现修改 jQuery Chosen下 拉框的背景的高度

  在实际的开发中,遇到比较苦逼的事情是,同事开发的系统中下拉框(chosen)展开后,一部分内容被背景(iframe)遮盖了,导致一些选项不能选择,这个问题抛给我,确实浪费了些宝贵的时间,,,

chosen 效果图

chosen

问题截图:

问题描述


bower_components目录下的插件包下chosen目录结构如下:

# Chosen

Chosen is a library for making long, unwieldy select boxes more user friendly.

- jQuery support: 1.4+
- Prototype support: 1.7+

...

那么问题该怎么解决呢?

解决思路:

  • 通过修改 iframe 的高度(背景通过 iframe 相关样式设置实现)
  • 通过修改 Dialog 的高度(背景通过 Dialog 相关样式设置实现)
  • 最后,也就是通过修改Chosen插件包的相关样式设置

问题解决办法:

  • 调整chosen CSS相关设置(chosen.css)
/*!
Chosen, a Select Box Enhancer for jQuery and Prototype
by Patrick Filler for Harvest, http://getharvest.com

Version 1.6.2
Full source at https://github.com/harvesthq/chosen
Copyright (c) 2011-2016 Harvest http://getharvest.com

MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
*/

... 

/* @end */
/* @group Results */
.chosen-container .chosen-results {
  color: #444;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0 4px 4px 0;
  padding: 0 0 0 4px;
  max-height: 70px;
  -webkit-overflow-scrolling: touch;
}

...
  • 调整 相关页面的代码

...

style="margin-top: 60px; margin-bottom: 60px;"

...

插叙:

  • 不要笑我修改的方式,确实也受到技术的限制(有些东西不懂),这是我实现的方式,多多分享,谢谢!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xsimah

创作不易,感谢客官的打赏

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值