HTML(趣味气球网首页发布会)

一主界面



二主页代码量

1.HTML文件


2 CSS文件


PS:这学期以来整个代码量不知道怎么查询


三 趣味气球网子页分别是




四 做趣味气球网时,遇到的最大问题:

1.怎么让导航条固定在顶部?


.navbar-fixed-top  .navbar-fixed-bottom设置如下CSS属性  position: fixed;

2. carousel的上一页 下一页

  可以用到 bootstrop 的字体图标组件


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
这是一个简单的点击气球游戏的代码,气球被点击时会爆炸,并且计分器会增加分数。你可以根据需要进行修改和调整。 HTML代码: ```html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>点击气球游戏</title> <style> #container { width: 600px; height: 400px; position: relative; margin: 0 auto; background-color: #f0f0f0; } .balloon { width: 80px; height: 120px; position: absolute; cursor: pointer; background-image: url('balloon.png'); background-size: cover; transition: all 0.5s ease-out; } .balloon:hover { transform: scale(1.2); } .balloon.burst { background-image: url('burst.png'); background-size: cover; } #score { font-size: 24px; font-weight: bold; text-align: center; margin-top: 20px; } </style> </head> <body> <div id="container"> <div id="score">Score: 0</div> </div> <script src="game.js"></script> </body> </html> ``` JavaScript代码: ```javascript var container = document.getElementById('container'); var score = document.getElementById('score'); var balloons = []; // 创建气球 function createBalloon() { var balloon = document.createElement('div'); balloon.className = 'balloon'; balloon.style.left = Math.random() * (container.clientWidth - balloon.clientWidth) + 'px'; balloon.style.top = Math.random() * (container.clientHeight - balloon.clientHeight) + 'px'; container.appendChild(balloon); balloons.push(balloon); } // 气球被点击时触发 function burstBalloon(event) { var balloon = event.target; balloon.className = 'balloon burst'; balloon.removeEventListener('click', burstBalloon); score.innerText = 'Score: ' + (parseInt(score.innerText.split(' ')[1]) + 1); setTimeout(function() { balloon.parentNode.removeChild(balloon); balloons.splice(balloons.indexOf(balloon), 1); }, 500); } // 开始游戏 function startGame() { setInterval(createBalloon, 1000); container.addEventListener('click', function(event) { if (event.target.className === 'balloon') { burstBalloon(event); } }); } startGame(); ``` 你需要将代码中的 `balloon.png` 和 `burst.png` 替换为你自己的图片。这个游戏还很简单,你可以添加更多的功能,比如时间限制、多种颜色的气球、不同大小的气球等等。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值