<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<!-- ScrollReveal v3.3.6 -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/scrollReveal.js/3.3.6/scrollreveal.min.js"></script>
</head>
<body>
<style>
.grid {
/* 排版用,不影響功能*/
height: 300px;
margin: 50px;
background: #ccc;
font-size: 50px;
line-height: 300px;
text-align: center;
}
</style>
<div class="grid">1</div>
<div class="grid">2</div>
<div class="grid">3</div>
<div class="grid">4</div>
<script>
window.sr = ScrollReveal({
// 參數設定[註1]
origin: "bottom", // 起始位置
distance: "20px", // 距離
duration: 500, // 動畫時間
delay: 0, // 動畫延遲時間
rotate: { x: 0, y: 0, z: 0 }, // 旋轉角度
opacity: 0, // 透明度
scale: 0.9, // 縮放比例
easing: "cubic-bezier(0.6, 0.2, 0.1, 1)", // 動畫速度曲線
container: window.document.documentElement, // 外層
mobile: true, // 支援行動裝置
reset: true, // 每次都啟動動畫
useDelay: "always", // 延遲動畫次數
viewFactor: 0.2, // 當該物件在可視範圍內,則顯示此物件(0.2表示可視範圍20%)
viewOffset: { top: 0, right: 0, bottom: 0, left: 0 }, // 當外層有設定間隔造成偏移,則請設定在此維持精準度
beforeReveal: function (domEl) { console.log(1) }, // 當啟動前,則執行此函式
beforeReset: function (domEl) {console.log(2) }, // 當重啟前,則執行此函式
afterReveal: function (domEl) {console.log(3) }, // 當啟動後,則執行此函式
afterReset: function (domEl) {console.log(4) } // 當重啟後,則執行此函式
});
sr.reveal( ".grid", {
// 參數設定[註1]
});
</script>
</body>
</html>
Output
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |