当前位置:网站首页>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);
});
边栏推荐
- 538. convert binary search tree to cumulative tree
- 六月集训(第11天) —— 矩阵
- Metasploitabile2 target learning
- The nearest common ancestor of 235 binary search tree
- 022-Redis数据库0基础入门
- Shuffleerror:error in shuffle in fetcher solution
- Docker安装Mysql、Redis
- 山东大学项目实训之examineListActivity
- Convert multiple pictures into one NPY file storage
- Mediaextractor source code analysis of multimedia framework analysis (1)
猜你喜欢

Redux learning (I) -- the process of using Redux

通过R语言且只用基础package来制作一个小游戏

617. 合并二叉树

PHP laravel8 send email

FPGA Design -- ping pong operation implementation and Modelsim simulation

socket. IO cross domain stepping pit

Sohu employees encounter wage subsidy fraud. What is the difference between black property and gray property and how to trace the source?

UEFI finding PCI devices

autojs,读取一行删除一行,停止自己外的脚本

Markdown + typora + picgo experimental report template attached
随机推荐
Throttling and anti shake
Why is it that the live video of the devices connected to easygbs suddenly cannot be played? Insufficient database read / write
动态import
Metasploitabile2 target learning
563. 二叉树的坡度
JS implementation of graphic merging and sorting process [source code attached]
Training and testing of super score model in mmediting
Detailed explanation of mutual call between C language and Lua
Shuffleerror:error in shuffle in fetcher solution
Transfer Learning
FPGA interview notes (II) -- synchronous asynchronous D flip-flop, static and dynamic timing analysis, frequency division design, retiming
538.把二叉搜索树转换成累加树
C language war "minesweeping"
LeetCodeT526
On cursor in MySQL
text-overflow失效
山东大学项目实训之examineListActivity
End of 2021 graphics of Shandong University
Text overflow failure
arguments......