weaver-design / wued-d2d-camp Goto Github PK
View Code? Open in Web Editor NEWA designer to developer tutorial shared by WUED. 从设计狮到程序猿的全栈训练营。
License: GNU General Public License v3.0
A designer to developer tutorial shared by WUED. 从设计狮到程序猿的全栈训练营。
License: GNU General Public License v3.0
下方代码是给div添加样式并在某一个div处设置条件赋予 “return false” 来
停止循环。
问题一:为什么.each(function(i)中的i不用声明就可以使用,它是一个形参吗,为什么默认就是div的索引值?
问题二:参考代码中的domEle是一个实参吗,他和我用的$(this)有区别吗。另外我把$(this).css 改成 this.css就不行了,this取得是一个dom对象,css不就是它的 属性吗?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<!-- jQuery (V1.11.0) -->
<script src="/new/libs/jquery/jquery.min.js"></script>
<style>
div {
width: 400px;
background-color: aquamarine;
height: 170px;
}
</style>
</head>
<body>
<!-- <img>
<img> -->
<button>start</button>
<span></span>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div id="stop" ></div>
<div></div>
<script>
// $('img').each(function(i){
// var e = i+1
// this.src = '../images/img_3trends_' + e + '.png'
// })
$('button').click(function(){
$('div').each(function(i){
$(this).css('backgroundColor','yellow');
if($(this).is('#stop')){
$('span').text('Stopped at div index' + i);
return false;
}
})
})
//下方为参考代码
// $("button").click(function () {
// $("div").each(function (index, domEle) {
// // domEle == this
// $(domEle).css("backgroundColor", "yellow");
// if ($(this).is("#stop")) {
// $("span").text("Stopped at div index #" + index);
// return false;
// }
// });
// });
</script>
</body>
</html>
一般我们在对网页进行代码或者链接资源修改后,需要清除浏览器缓存,再刷新页面才能看到最新、正确的效果。但是,对清除缓存这一操作不熟悉的用户,就无法看到正确的页面效果,这个问题怎么解决?
var WUXD = [
{
name: '照照',
age: 18
},
{
name: '平江',
age: 18
},
{
name: '杨柳',
age: 18
},
{
name: '红雨',
age: 17
},
{
name: '双双',
age: 18
}
];
💯 好奇怪,有人告诉我吗?求助 @jack-g-chen @GitHuboooSHY @blankyl @kangshuang
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.