当前位置:网站首页>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

边栏推荐
- C program termination problem clr20r3 solution
- socket编程——epoll模型
- Webgl Google prompt memory out of bounds (runtimeerror:memory access out of bounds, Firefox prompt index out of bounds)
- 将jar包注册为服务,实现开机自动启动
- Creating a binary tree (binary linked list) from a generalized table
- Is it safe to open an account on the compass?
- 华泰证券在上面开户安全吗?靠谱吗?
- vscode试图过程写入管道不存在
- 203 postgraduate entrance examination Japanese self-study postgraduate entrance examination experience post; Can I learn Japanese by myself?
- Voiceprint Technology (VII): the future of voiceprint Technology
猜你喜欢

Applet cloud development joint table data query and application in cloud function
![[opencv] - input and output XML and yaml files](/img/4e/7944e205c71246d0b0e3747eefca37.png)
[opencv] - input and output XML and yaml files

matplotlib matplotlib中决策边界绘制函数plot_decision_boundary和plt.contourf函数详解

The meshgrid() function in numpy

首期Techo Day腾讯技术开放日,628等你!
![[zufe school competition] difficulty classification and competition suggestions of common competitions in the school (taking Zhejiang University of Finance and economics as an example)](/img/ee/2b8aebc1c63902d4d85ff71fd45070.jpg)
[zufe school competition] difficulty classification and competition suggestions of common competitions in the school (taking Zhejiang University of Finance and economics as an example)

With the QQ group file storage function of super nice, you immediately have n cloud disks that are easy to download and never expire
![[competition - Rural Revitalization] experience sharing of Zhejiang Rural Revitalization creative competition](/img/b4/84c30ed112c4dffd8d51697b2f4a4f.jpg)
[competition - Rural Revitalization] experience sharing of Zhejiang Rural Revitalization creative competition

【mysql学习笔记22】索引

TLAB mechanism of JVM object memory allocation and TLAB process in G1
随机推荐
Voiceprint Technology (I): the past and present life of voiceprint Technology
sklearn PolynomialFeatures的具体用法
Lvs-dr mode single network segment case
Voiceprint Technology (I): the past and present life of voiceprint Technology
《乔布斯传》英文原著重点词汇笔记(六)【 chapter three 】
Chinese solution cannot be entered after webgl is published
Wechat official account can reply messages normally, but it still prompts that the service provided by the official account has failed. Please try again later
Are the top ten securities companies at great risk of opening accounts and safe and reliable?
[matlab] image binarization (imbinarize function)
JMeter interface test, associated interface implementation steps (token)
socket编程——poll模型
证券开户风险大吗,安全靠谱吗?
行业春寒回暖,持续承压的酒店企业于何处破局?
【OpenCV】—输入输出XML和YAML文件
Notes on key words in the original English work biography of jobs (VI) [chapter three]
TLAB mechanism of JVM object memory allocation and TLAB process in G1
Compile time annotations for custom annotations (retentionpolicy.class)
Is it safe for Huatai Securities to open an account on it? Is it reliable?
[buuctf.reverse] 121-125
浅谈Mysql底层索引原理