This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 自动滚动 | |
// div#demo style:overflow:hidden | |
// div#demo1 | |
// div#demo2 | |
var SPEED = 60, | |
demo2 = document.getElementById("demo2"), | |
demo1 = document.getElementById("demo1"), | |
demo = document.getElementById("demo"); | |
function Marquee() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<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>Image Drag Preview</title> | |
<style> | |
* { margin: 0; padding: 0; } | |
#box { padding: 10px; min-height: 500px; background: #f0f0f0; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dispatchCustomEvent(name, data) { | |
var e; | |
if (window.CustomEvent) { | |
e = new window.CustomEvent(name, { | |
canBubble: true, | |
cancelable: true, | |
detail: data | |
}) | |
} else { | |
e = document.createEvent('CustomEvent'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scrollElementIntoView(el, offsetTop) { | |
var doc = document.documentElement | |
var docScrollTop = doc.scrollTop || 0 | |
var viewportHeight = window.innerHeight | |
var rect = el.getBoundingClientRect() | |
if (rect.top < 0 || rect.top + rect.height > docScrollTop + viewportHeight) { | |
var elOffsetTop = (rect.top + docScrollTop) | |
var newScrollTop = elOffsetTop - (offsetTop > 0 ? offsetTop : (rect.height > viewportHeight ? 0 : (viewportHeight - rect.height) / 2)) | |
doc.scrollTop = newScrollTop | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=1, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>BFCache & pageshow</title> | |
</head> | |
<body> | |
<a href="https://www.baidu.com/">leave to baidu.com</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var colors = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'] | |
function F(text) { | |
this.text = text | |
this.attr = 0 | |
this._color = 0 | |
this._bgColor = 0 | |
} | |
F.prototype.toString = function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generateSql(db) { | |
return ` | |
SELECT | |
t.table_name, | |
c.column_name, | |
c.data_type | |
FROM | |
INFORMATION_SCHEMA.TABLES t JOIN | |
INFORMATION_SCHEMA.COLUMNS c ON | |
t.table_schema = c.table_schema AND |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
presets: [ | |
[ | |
'@babel/env', | |
{ | |
useBuiltIns: 'usage', | |
modules: false | |
} | |
] | |
] |