手机底部导航栏

8 篇文章 1 订阅
7 篇文章 0 订阅
图标获取:
http://www.iconfont.cn/home/index?spm=a313x.7781069.1998910419.2

代码如下:
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Document</title>
	<script type="text/javascript" src='jquery.min.js'></script>
	<style>
		*{
			margin:0;
			padding:0;
			font-family:微软雅黑;
		}
		ul{
			list-style:none;
		}
		#content{
			position:fixed;
			bottom:0;
			left:0;
			width:100%;
			height:4rem;
			box-shadow:0 0 1rem #222;
		}
		#content ul{
			display:flex;
			flex-wrap:wrap;
			justify-content:space-around;
			align-items:center;
			width:100%;
			height:100%;
		}
		#content ul li{
			width:25%;
			height:4rem;
			text-align:center;
		}
		#content ul li img{
			margin-top:0.8rem;
			width:1.5rem;
			height:1.5rem;
			line-height:3rem;
		}
		#content ul li p{
			font-size:0.8rem;
		}

		.bottomBackground{
			color:#fc6;
		}
	</style>
</head>
<body>
	<div id="content">
		<ul>
			<li class='bottom-li'>				
				<img src="b1.png" width='200' height='200' alt="">
				<p>主页</p>
			</li>
			<li class='bottom-li'>
				<img src="a2.png" width='358' height='131' alt="">
				<p>主页</p>
			</li>
			<li class='bottom-li'>
				<img src="1.webp" width='358' height='131' alt="">
				<p>主页</p>
			</li>
			<li class='bottom-li'>
				<img src="1.webp" width='358' height='131' alt="">
				<p>主页</p>
			</li>
		</ul>
	</div>
</body>
<script>

	//var num1=$("ul > a:eq(0)").attr("ID");
	//var num2=$("ul").children("a:eq(0)").attr("ID");
	//var num3=$("ul").find("a:eq(0)").attr("ID");

	//点击bottom-li
	$('.bottom-li').click(function(){
		//这个被点击的bottom-li加上这个类
		$(this).addClass('bottomBackground');
		//bottom-li不包含被点击的这个的都去掉bottomBackground这个类
		$('.bottom-li').not($(this)).removeClass('bottomBackground');
		//被点击的这个在bottom-li中是第几个
		var idx = $(this).index('.bottom-li');

		//如果被点击的这个是第一个的话,则改变第一个图片
		if(idx == 0){
			$(this).find('img').attr('src','b2.png');
		}else{
			$('.bottom-li').eq(0).find('img').attr('src','b1.png');
		}

		if(idx == 1){
			$(this).find('img').attr('src','a1.png');
		}else{
			$('.bottom-li').eq(1).find('img').attr('src','a2.png');
		}		
	});
</script>
</html>


  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
在uni-app中,如果你不希望底部导航栏显示,有两种方法可以实现。第一种方法是将页面的navigationStyle设为custom,第二种方法是将页面的titleNView设为false。具体的配置可以通过修改pages.json文件来实现。以下是一个示例: ```json "pages" : [ { "path" : "pages/index/index", "style": { "navigationBarTitleText": "英特网络", "navigationStyle":"custom" } }, ] ``` 在上述示例中,我们将navigationStyle设为custom,这样底部导航栏就不会显示了。你也可以将titleNView设为false来达到同样的效果。 另外,如果你想要让页面内容不被手机顶部的状态栏区域覆盖,你可以使用uni-app提供的状态栏高度的css变量--status-bar-height。通过设置一个占位div,并将其高度设为css变量,你可以让页面内容下移,避免被状态栏遮挡。 ```html <template> <view> <view class="status_bar"> <!-- 这是状态栏 --> </view> <view> 状态栏下的文字 </view> </view> </template> <style> .status_bar { height: var(--status-bar-height); width: 100%; } </style> ``` 在上述示例中,我们通过设置一个高度为--status-bar-height的占位div,将状态栏的位置让出来,使页面内容不被状态栏覆盖。<span class="em">1</span><span class="em">2</span> #### 引用[.reference_title] - *1* *2* [uni-app 设置原生导航栏不显示](https://blog.csdn.net/weixin_44640323/article/details/109114171)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值