jQuery手机下拉框select

jQuery手机下拉框select

添加时间:2021-02-28 22:33:37
站长推荐丨赞助论坛,可获取海量资源终身免费下载权限奥!
举报 举报
收藏
预览
附件 附件
  • 模板类型模板类型:下拉框
  • 模板颜色模板颜色:初级
  • 下载积分下载积分:28 米粒
  • 下载权限下载权限:

    赞助会员

本demo通过js更改html字体大小,使字体随浏览器窗口大小自适应。相关手机模板字体大小和图片响应式模板教程:https://jy.tp.yuanmeng.life/js/509.html
jQuery手机下拉框select
分类:手机特效 > 下拉框 难易:初级

单个下拉框html模板

<div class="selects">
    <div class="selects_head">
        <a class="arrow"><img  src="images/arrow_bottom.png"></a>
        <span class='selected'>储蓄卡</span>
    </div>
    <div class="selects_other">
        <a href="javascript:" title="中国农业银行">
            <img src="images/zs1.png" />
        </a>
        <a href="javascript:"   title="中国建设银行">
            <img src="images/zs2.png" />
        </a>
        <a href="javascript:"   title="中国工商银行">
            <img src="images/zs3.png" />
        </a>
    </div>
</div>

下拉框样式

.selects {
	display: block;
	width: 70%;
	height: 1.6rem;
	line-height: 1.6rem;
	font-size: 0.8rem;
	color: #555;
	background-color: #fff;
	border: 1px solid #ccc;
	border-radius: 0.1rem;
	position: relative;
	margin:auto;
	padding:0 0 0 0.5rem;
}
.selects_other {
	position: absolute;
	left:-0.02rem;
	top:1.6rem;
	width:100%;
	display: none;
	z-index:999;
	border-top: 1px solid #ccc;
}
.selects a.arrow img {
	width:0.7rem;
	position: absolute;
	right:0.5rem;
	top:0.6rem
}
.selects_other a {
	border: 1px solid #ccc;
	border-top:none;
	display: block;
	width:100%;
	padding:0.1rem 0;
	text-indent: 0.5rem;
	height: 1.6rem;
	line-height: 1.6rem;
	background-color: #FFF
}
.selects_other a img {
	height: 0.8rem;
}

字体自适应

(function() {
    function sizeHtml() {
        window.mtSizeBase = $(window).width() / 16;
        window.mtSizeBase = window.mtSizeBase > 45 ? 45 : window.mtSizeBase;
        $("html").css("font-size", window.mtSizeBase + "px");
    }
    sizeHtml();
    $(window).resize(function() {
        setTimeout(function() {
            sizeHtml();
        }, 300);
    });
})();

下拉框select点击

//银行下来点击
$(".selects_other").children("a").click(function() {
    $(this).parents('.selects').find(".selected").text($(this).attr("title"));
    $(".selects_other").hide();
    $(this).parents('.selects').find(".selects_head img").attr("src", "images/arrow_bottom.png");
})
//头部点击 显示或隐藏下拉,并切换箭头图片
$(".selects_head").click(function() {
    if ($(this).parent().children(".selects_other").css("display") == 'none') {
        $(this).parent().children(".selects_other").show();
        $(this).find("img").attr("src", "images/arrow_top.png");
    } else {
        $(this).parent().children(".selects_other").hide();
        $(this).find("img").attr("src", "images/arrow_bottom.png");
    }
})
相关内容推荐
资源求助发帖
查看更多发帖

*

回帖描述:

*

链接类型:

*

下载链接:

密码:
发帖规则:回帖内容为会员之间的私信,普通网友无法查看。
免责声明:回帖中提供的链接内容仅供会员之间学习参考使用,获取内容后请在法律法规范围内使用。回帖提供的内容应符合法律法规要求,不得违反法律法律的要求。
站点权责:回帖内容如违反法律法规,站点有权封停账号使用权利。对用户举报的内容,站点有责任及时删除违规内容。
热点内容推荐
标题:jQuery手机下拉框select

*

描述:
平均回复时间:3-10分钟
规则介绍:悬赏寻求论坛网友分享资源,站点对分享内容的准确性,合法性,版权等没有足够的监管能力。如果您发现资源不正确,无法使用,不符合法律法律等情况,您可以直接举报资源。站长将尽快核实您的举报,并根据情况,采取封号,退换米粒等处理。

*

回帖描述:

*

链接类型:

*

阅读权限:

*

下载链接:

密码:
发帖规则:回帖内容为会员之间的私信,普通网友无法查看。
免责声明:回帖中提供的链接内容仅供会员之间学习参考使用,获取内容后请在法律法规范围内使用。回帖提供的内容应符合法律法规要求,不得违反法律法律的要求。
站点权责:回帖内容如违反法律法规,站点有权封停账号使用权利。对用户举报的内容,站点有责任及时删除违规内容。
  • 背景波浪
  • 背景波浪
  • 波浪
  • 波浪
客服
在线咨询
周一 至 周日 9:00 ~ 22:00
QQ:1326974360
微信:juyoubuluo6688
客服热线
18205485173
工作日 9:00 ~ 18:00
微信扫码咨询
客户服务
欢迎咨询服务
咨询量较多时,请耐心等待
社群

关注公众号

获取更多资讯

扫码进群(QQ)

与更多大牛交流沟通

0.104157s