Skip to content

Instantly share code, notes, and snippets.

View lucifiel0121's full-sized avatar

Ashe lucifiel0121

View GitHub Profile
// 原生js api 選擇器
const btnChange = document.querySelectorAll('.btn-change-content');
for (let index = 0; index < btnChange.length; index++) {
// 綁定 addEventListener
btnChange.item(index).addEventListener('click', function () {
// this.innerHTML -> 選到的html DOM 內容 ( class="this.innerHTML" )
// 取btn區塊 html DOM
let domBtn = this.parentNode.parentNode.nextElementSibling;
// console.log(domBtn);
@lucifiel0121
lucifiel0121 / 原生 js api 寫 click事件
Last active October 30, 2018 07:52
原生 js api 寫 click事件
// 原生 js api 寫 click事件
// 取個變數,比較短
const btnChange = document.querySelectorAll('.btn-change-content');
// 如果直接取 document.querySelector ,取到第一個就會回傳,詳細看 MDN
// 如果直接用 querySelectorAll ,直接 '點' ( document.querySelectorAll. ) 會找不到可以用的方法(methods)
// 要取 .item() 指定才有方法可以用,所以把 item()寫進迴圈全部取進來。
for (let index = 0; index < btnChange.length; index++) {
//addEventListener事件監聽器 , 可以去找看看 click 和 onclick 有什麼不一樣
btnChange.item(index).addEventListener('click', function () {
// classList 直接有方法可以取用 不過 ie支援度 ... :(
@lucifiel0121
lucifiel0121 / scss
Created October 30, 2018 03:08
Sass - .scss map
$grid-end: 8;
$gutter: 30px;
* {
box-sizing: border-box;
}
.container {
max-width: 960px;
margin: 0 auto;
}
.box {
- [TypeScript 特色與歷史簡介](https://oomusou.io/typescript/intro/)
- [TypeScript 之基本型別](https://oomusou.io/typescript/basic-type/)
- [TypeScript 之變數宣告與建立](https://oomusou.io/typescript/variable/)
- [TypeScript 之 Function](https://oomusou.io/typescript/function/)
- [TypeScript 之 Arrow Function](https://oomusou.io/typescript/arrow-function/)
- [TypeScript 之 Module](https://oomusou.io/typescript/module/)
@lucifiel0121
lucifiel0121 / cloudSettings
Last active February 23, 2020 07:21
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-02-23T07:21:31.947Z","extensionVersion":"v3.4.3"}
gulp.task('name'[,deps],function)
// gulp.task 宣告任務
// name : 命名
gulp.task('hello',function(){
console.log('Hello world!');
})