当前位置:网站首页>Starting from scratch (I)
Starting from scratch (I)
2022-06-11 06:38:00 【Dare you look at the avatar for three seconds?】
Website structure
html css And js The combination of The necessary preparations
We need to use the jquery Open source core library , So go to relevant websites to download , Then build js file , take jq Apply to new file
establish css file
establish js file The core control file for the game
At first I wanted to make the background move , There may be two main points involved here :
1 Through the clock control
2 Setting will change the variable to see the value of the background picture you are telling
The basic structure :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title> Aircraft battle </title>
<link rel="stylesheet" type="text/css" href="css/commen.css"/>
<link rel="stylesheet" type="text/css" href="css/main.css"/>
<script src="js/jquery-3.6.0.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/main.js" type="text/javascript" charset="utf-8"></script>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
</head>
<body>
<div id="stage">
<div class="bg1"></div>
</div>
</body>
</html>
Background movement :
$(function(){
// When writing code here, you can control all html Code
//dom
var stage=document.getElementById("stage"); // Get stage nodes
var bg1=stage.getElementsByClassName("bg1")[0];// Get a background picture
// console.log(bg1)
var topval=0;
// bg1.style.cssText="top: -30px;"
var t1=setInterval(function(){
// console.log("ddd")
console.log(bg1.style.cssText)
// bg1.scrollTop=bg1.scrollTop+10;
bg1.style.cssText="top: "+topval+"px";
topval+=1
},70);
});
边栏推荐
- Using Metasploit Trojan horse for remote control
- Handwritten promise [04] - then method chain call to recognize promise object self return
- Array de duplication....
- Handwritten a message queue in two ways
- On the social moral and ethical issues behind short videos (personal point of view, for reference only)
- ijkPlayer中的错误码
- LeetCodeT526
- ERROR 1215 (HY000): Cannot add foreign key constraint
- Dynamic import
- 关于SIoU的原理和代码实现(回顾IoU、GIoU、DIoU、CIoU)
猜你喜欢

Use of qscriptengine class

Jenkins different styles of project construction

The classification effect of converting video classification data set to picture classification data set on vgg16

FPGA interview notes (II) -- synchronous asynchronous D flip-flop, static and dynamic timing analysis, frequency division design, retiming

Jenkins voucher management

572. subtree of another tree

What is sentinel produced by Ali?
![[]==! []](/img/65/ab724c74b080da319ed5c01c93fdb7.png)
[]==! []
![Illustration of JS implementation from insertion sort to binary insertion sort [with source code]](/img/e5/1956af15712ac3e89302d7dd73f403.jpg)
Illustration of JS implementation from insertion sort to binary insertion sort [with source code]

Vulnhub's breach1.0 range exercise
随机推荐
山东大学项目实训之examineListActivity
572. 另一个树的子树
Quick sorting of graphic array [with source code]
Error code in ijkplayer
MMEditing中超分模型训练与测试
ERROR 1215 (HY000): Cannot add foreign key constraint
Text overflow failure
On cursor in MySQL
Shandong University machine learning final 2021
Vulhub 8.1-backdoor vulnerability recurrence
Docker安装Mysql、Redis
Redux learning (I) -- the process of using Redux
JS judge whether the year is a leap year and the number of days in the month
The nearest common ancestor of 235 binary search tree
break,continue有什么区别和用法?
FMT package usage of go and string formatting
Ethical discussion on reptile Technology
核查医药代表备案信息是否正确
Jenkins voucher management
Jenkins user rights management