当前位置:网站首页>Simple waterfall effect
Simple waterfall effect
2022-06-25 09:34:00 【silno】
Toss around for a few days , Finally, I made a simple waterfall flow effect without plug-ins
Go straight to the code , It can be used in practice . Take it for reference if necessary . Mobile phone vertical display 2 Column , The horizontal screen shows 3 Column . The computer displays... According to the browser size 2-4 Column , The specific number of columns can be adjusted according to the browser size .
The picture is a screenshot of the effect . Prepare the picture materials by yourself
<!DOCTYPE html>
<meta charset="utf-8" />
<body>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<style>
.parent1 {
width:100%;
-moz-column-count: 2;
-webkit-column-count: 2;
column-count: 2;
}
.child1 {
margin-bottom:20px;
-moz-page-break-inside: avoid;
-webkit-column-break-inside: avoid;
break-inside: avoid;
color:#0f0; }
</style>
<script>
var x=0;
var heng=heng_flag();
var mobile_flag = isMobile();
$(document).ready(function(){
var x=document.documentElement.clientWidth||document.body.clientWidth;
heng=heng_flag();
x=$(".aacc").width();
buju(x);
// Monitor horizontal and vertical screen
var evt = "onorientationchange" in window ? "orientationchange" : "resize";
window.addEventListener(evt,resize,false);
function resize(fals) {
heng=heng_flag();
}
resize(true);
$(window).resize(function(){
x=document.documentElement.clientWidth||document.body.clientWidth;
x=$(".aacc").width();
buju(x);
});
});
function buju(w){
var c=0;
var w_c=0;
if(heng){
//alert("heng1 "+heng);
if(w>1400){
c=4;
w_c=4.15;
}else if(w>800){
c=3;
w_c=3.15;
}else{
c=2;
w_c=2.1;
}
if(mobile_flag){
c=4;
w_c=4.15;
}
}else{
c=2;
w_c=2.1;
}
$(".parent1").css("column-count",c);
$(".parent1").css("-moz-column-count",c);
$(".parent1").css("-webkit-column-count",c);
$(".child1 img").width(w/w_c);
}
function heng_flag() {
if(window.orientation == 0 || window.orientation == 180) {
return false;
}else {
return true;
}
}
function isMobile() {
var userAgentInfo = navigator.userAgent;
var mobileAgents = [ "Android", "iPhone", "SymbianOS", "Windows Phone", "iPad","iPod"];
var mobile_flag = false;
// according to userAgent Judge if it's a cell phone
for (var v = 0; v < mobileAgents.length; v++) {
if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
mobile_flag = true;
break;
}
}
var screen_width = window.screen.width;
var screen_height = window.screen.height;
// Judge whether it is a mobile phone according to the screen resolution
if(screen_width < 500 && screen_height < 800){
mobile_flag = true;
}
return mobile_flag;
}
</script>
<div id id="aacc" class="aacc" style="width:95%;">
<div class="parent1">
<div class="child1"><img src="images/9.jpg">5</div>
<div class="child1"><img src="images/1.jpg">1</div>
<div class="child1"><img src="images/2.jpg">2</div>
<div class="child1"><img src="images/3.jpg">3</div>
<div class="child1"><img src="images/5.jpg">6</div>
<div class="child1"><img src="images/4.jpg">3</div>
<div class="child1"><img src="images/6.jpg">5</div>
<div class="child1"><img src="images/7.jpg">6</div>
<div class="child1"><img src="images/8.jpg">0</div>
<div class="child1"><img src="images/0.jpg">8</div>
<div class="child1"><img src="images/1.jpg">9</div>
</div>
</div>
</body>
picture 4 Column effect
picture 2 Column effect
边栏推荐
- Notes on key words in the original English work biography of jobs (III) [chapter one]
- Voiceprint Technology (V): voiceprint segmentation and clustering technology
- Matplotlib decision boundary drawing function plot in Matplotlib_ decision_ Boundary and plt Detailed explanation of contour function
- Is it safe to open an account with Great Wall Securities by mobile phone?
- Mapping mode of cache
- 3、 Automatically terminate training
- Atguigu---18-component
- 35 websites ICER must know
- Prepare for the 1000 Android interview questions and answers that golden nine silver ten must ask in 2022, and completely solve the interview problems
- Notes on key words in the original English work biography of jobs (IV) [chapter two]
猜你喜欢
How can games copied from other people's libraries be displayed in their own libraries
8、智慧交通项目(1)
Make a skylearn high-dimensional dataset_ Circles and make_ moons
【OpenCV】—离散傅里叶变换
Explanation of assertions in JMeter
vscode试图过程写入管道不存在
CSV parameterization in JMeter
2022 postgraduate entrance examination experience post -- Alibaba Business School of Hangzhou Normal University -- management science and Engineering (including the recommendation of books and course
Oracle-单行函数大全
Use Navicat to compare data differences and structure differences of multi environment databases, and automatic DML and DDL scripts
随机推荐
35 websites ICER must know
Matplotlib decision boundary drawing function plot in Matplotlib_ decision_ Boundary and plt Detailed explanation of contour function
【mysql学习笔记22】索引
How can games copied from other people's libraries be displayed in their own libraries
Notes on key words in the original English work biography of jobs (III) [chapter one]
C program termination problem clr20r3 solution
vscode试图过程写入管道不存在
Data-driven anomaly detection and early warning of 21 May Day C
[wechat applet full stack development course] course directory (mpvue+koa2+mysql)
Title B of the certification cup of the pistar cluster in the Ibagu catalog
pmp考试题型需要注意哪些?
Voiceprint Technology (II): Fundamentals of audio signal processing
CSV parameterization in JMeter
Close a thread
Is the client that gets the scanning code wechat or Alipay
Abbreviations of common English terms for IC R & D
《乔布斯传》英文原著重点词汇笔记(三)【 chapter one】
Notes on key vocabulary of the original English work biography of jobs (I) [introduction]
The first techo day Tencent technology open day, 628 waiting for you!
Wallys/MULTI-FUNCTION IPQ6010 (IPQ6018 FAMILY) EMBEDDED BOARD WITH ON-BOARD WIFI DUAL BAND DUAL