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 a = [1, 2, 45, 88]; | |
var b = [3, 7, 8]; | |
var flag = 0; | |
for (let i = 0; i < b.length; i++) { | |
if (b[i] <= a[flag] || flag > a.length) { | |
a.splice(flag, 0, b[i]); | |
} else { | |
i--; |
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
export default class AirScroll { | |
constructor(options, updateCb) { | |
this.container = options.container | |
this.itemHeight = options.itemHeight | |
this.containerHeight = options.containerHeight | |
this.sourceItems = options.items | |
this.items = [] | |
this.updateCb = updateCb | |
this.init() |
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
angular.module('virtualListApp') | |
.directive('uiVirtualList', | |
[function () { | |
'use strict'; | |
return { | |
restrict: 'E', | |
require: "ngModel", | |
templateUrl: "views/directives/ui-virtual-list.html", | |
scope: { | |
uiDataProvider: '=', |
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 outerClick(selector, fn) { | |
$(document).on("click", function (event) { | |
var isHit = $(event.target).closest(selector).length | |
if (!isHit) fn.call(fn, event) | |
}) | |
return function () { | |
$(document).off('click', fn) | |
} |
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
/* stats.js - http://github.com/mrdoob/stats.js*/ | |
var Stats = function () { | |
var l = Date.now(), m = l, g = 0, n = Infinity, o = 0, h = 0, p = Infinity, q = 0, r = 0, s = 0, f = document.createElement("div"); | |
f.id = "stats"; | |
f.addEventListener("mousedown", function (b) { | |
b.preventDefault(); | |
t(++s % 2) | |
}, !1); | |
f.style.cssText = "width:80px;opacity:0.9;cursor:pointer"; | |
var a = document.createElement("div"); |
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
[class^=scene-] { | |
transform: translate3d(0, 0, 0); | |
transition: .3s ease; | |
display: flex; | |
flex-flow: row nowrap; | |
@for $i from 0 through 5 { | |
&.scene-#{$i} { | |
transform: translate3d(#{-($i * 100%)}, 0, 0); | |
} |
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 lang="zh-cn"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
<link rel="stylesheet" href="demo.css"> | |
<!--<script src="index.js"></script>--> | |
</head> | |
<style> |
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 lang="zh-cn"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
<link rel="stylesheet" href="demo.css"> | |
<!--<script src="index.js"></script>--> | |
</head> | |
<style> |
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
$.fn.marquee = function (options) { | |
var $that = this | |
var that = this[0] | |
if (!that) return | |
options = $.extend({}, { | |
speed: 50 | |
}, options) | |
var timer = setInterval(marquee, options.speed) |
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
class Checker { | |
/** | |
* 生成一个 checker | |
* @param context 是一个object,跟itemKey配合得到items | |
* @param itemKey context中的items的key | |
* @param idKey 用于匹配的值 | |
* @example | |
this.checker = new Checker({ | |
context: this, | |
itemKey: 'items', |