复制和粘贴渲染脚本被破坏?
Copy and pasting renders script to be broken?
起初我以为我在 LESS 中复制了错误的代码,但后来我也在 jsfiddle 上测试了它,但它没有用,但是在原始副本中它可以用?
复制
HTML
<html lang="en">
<head class="Setup">
<link rel="stylesheet/less" type="text/css" href="../LESS/core.less"/>
<script src="../JavaScript/less.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script type='text/javascript' src="../JavaScript/java.js"></script>
</head>
<body class="Setup">
<ul>
<li class="PsuedoButtons" id="Menu1">Source1</li>
<li class="PsuedoButtons" id="Menu2">Source2</li>
<li class="PsuedoButtons" id="Menu3">Source3</li>
</ul>
</body>
</html>
剪掉不相关的部分
少
ul {
li {
display: flex;
float: left;
position: absolute;
height: 35px;
width: 65px;
top: 5px;
background: #e6e6e6;
list-style: none;
justify-content: center; // Horizontal
align-items: center; // Vertical
opacity: 0;
.rounded;
&.show {
opacity: 1;
}
}
#Menu1 {
left: 100px;
}
#Menu2 {
left: 200px;
}
#Menu3 {
left: 300px;
}
}
JQuery
var debounce = false;
$('#Option1').click(function() {
var time = 250;
if (debounce == true) {return;}
debounce = true;
$(".PsuedoButtons").each(function() {
console.log('hello');
setTimeout(function() {
$(this).toggle(); // Sadness
}, time)
time = time + 250
})
debounce = false;
});
JF 小提琴
https://jsfiddle.net/b7jo7w4L/:复制
https://jsfiddle.net/7a1cpu0n/ : 原创
问题出在 js fiddle 上。您需要加载外部资源(您缺少对 Jquery 的引用)
起初我以为我在 LESS 中复制了错误的代码,但后来我也在 jsfiddle 上测试了它,但它没有用,但是在原始副本中它可以用?
复制 HTML
<html lang="en">
<head class="Setup">
<link rel="stylesheet/less" type="text/css" href="../LESS/core.less"/>
<script src="../JavaScript/less.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script type='text/javascript' src="../JavaScript/java.js"></script>
</head>
<body class="Setup">
<ul>
<li class="PsuedoButtons" id="Menu1">Source1</li>
<li class="PsuedoButtons" id="Menu2">Source2</li>
<li class="PsuedoButtons" id="Menu3">Source3</li>
</ul>
</body>
</html>
剪掉不相关的部分
少
ul {
li {
display: flex;
float: left;
position: absolute;
height: 35px;
width: 65px;
top: 5px;
background: #e6e6e6;
list-style: none;
justify-content: center; // Horizontal
align-items: center; // Vertical
opacity: 0;
.rounded;
&.show {
opacity: 1;
}
}
#Menu1 {
left: 100px;
}
#Menu2 {
left: 200px;
}
#Menu3 {
left: 300px;
}
}
JQuery
var debounce = false;
$('#Option1').click(function() {
var time = 250;
if (debounce == true) {return;}
debounce = true;
$(".PsuedoButtons").each(function() {
console.log('hello');
setTimeout(function() {
$(this).toggle(); // Sadness
}, time)
time = time + 250
})
debounce = false;
});
JF 小提琴 https://jsfiddle.net/b7jo7w4L/:复制 https://jsfiddle.net/7a1cpu0n/ : 原创
问题出在 js fiddle 上。您需要加载外部资源(您缺少对 Jquery 的引用)