我有一个使用amCharts库创建的图表.但是我在每个条形图顶部的图像中面对一个不需要的裁剪,当它变得太高时,我在这里强调:

请帮助我不想要那种裁剪.
这是CSS代码:
#chartdiv {
width: 100%;
height: 500px;
padding: 70px 0;
border: 3px solid green;
}
body {
margin: 0 0 0 0;
overflow:hidden;
background-color: transparent;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
Run Code Online (Sandbox Code Playgroud)
这是JavaScript代码的最后一部分:
// Add bullets
var bullet = series.bullets.push(new am4charts.Bullet());
var image = bullet.createChild(am4core.Image);
image.width = 150;
image.height = 150;
image.horizontalCenter = "middle";
image.verticalCenter = "bottom";
image.dy = 80;
image.y = am4core.percent(100);
image.propertyFields.href = "bullet"; …Run Code Online (Sandbox Code Playgroud) 这是一段代码,用于创建一个sims通过for循环并使用命名的数组str1。
到目前为止,我需要sims手动定义长度,该长度等于str1like的长度:(let sims = [[],[],[],[]];四个数组,等于上的四个单词str1)
如何以编程方式用数组填充模拟人生?
var str1 = "do you ever looked";
var str2 = "do you fr ever looked";
let sims = [[],[],[],[]]; // instead I want let sims = [];
let s1 = str1.split(" ")
let s2 = str2.split(" ")
for (var j = 0; j < s1.length; j++) {
for (var i = 0; i < s2.length; i++) {
sims[j].push(s1[j].toString());
}
}
console.log(sims);Run Code Online (Sandbox Code Playgroud)
假设我有这个空数组:
var list = [];
Run Code Online (Sandbox Code Playgroud)
这是一个问题:如果我的data数组中充满了6个这样的对象:
var data = [];
data[0] = { Name: "Jack", accuracy: "average", accent: 79, weight: 1 };
data[1] = { Name: "Sara", accuracy: "good", accent: 24, weight: 2 };
data[2] = { Name: "Nick", accuracy: "not bad", accent: 89, weight: 1 };
data[3] = { Name: "Doe", accuracy: "good", accent: 88, weight: 4 };
data[4] = { Name: "Lee", accuracy: "excellent", accent: 63, weight: 9 };
data[5] = { Name: "Sasha", accuracy: "good", …Run Code Online (Sandbox Code Playgroud) 我的屏幕上有两个按钮。每个人都会触发一段 javascript 代码来进入和退出全屏模式。
按钮 1:进入全屏模式
按钮 2:退出全屏模式
如果我首先单击按钮 1,它会将我带到全屏模式,然后如果我单击按钮 2,它将退出全屏模式。
但是,如果我使用F11或通过chrome menu进入全屏模式,意外地按钮 2不再工作。
为什么会发生这种情况以及如何解决?
按钮 1 代码:
goFullscreen();
function goFullscreen() {
var el = document.documentElement,
rfs = el.requestFullscreen
|| el.webkitRequestFullScreen
|| el.mozRequestFullScreen
|| el.msRequestFullscreen
;
rfs.call(el);
}
Run Code Online (Sandbox Code Playgroud)
按钮 2 代码:
document.webkitCancelFullScreen();
Run Code Online (Sandbox Code Playgroud)
我也试过这个,但没有运气:
document.webkitExitFullscreen();
Run Code Online (Sandbox Code Playgroud) 我有一个CSS代码,可在此处创建简单的虚线边框:
border: 5px dotted #ff2100
Run Code Online (Sandbox Code Playgroud)
现在问题出在最顶端,最后两个点太靠近了……
如果我希望所有点之间都等距怎么办...请帮助...
编辑:我只需要在chrome上,这是整个CSS(border: 5px dotted #ff2100在最后...)
html {
overflow: hidden;
width: 1470px;
height: 450px;
margin-top: -3px;
margin-left: 5px;
}
.row {
display: flex;
}
.column {
flex: 50%;
}
.profile {
padding: 0px;
margin: 100px 70px 0px 0px;
width: 50%;
height: 25px;
box-sizing: border-box;
color:#161b7a;
}
.profile .name {
margin-right: -260px;
font-family: "Helvetica";
font-weight: 600;
src: url(helveticaneue-ultrathin.woff);
float: right;
width: 200px;
height: 50px;
}
.profile .job {
margin-right: -260px;
margin-top: 25px;
font-family: "Helvetica"; …Run Code Online (Sandbox Code Playgroud) 我对音频几乎一无所知。
但我知道,当我将 YouTube 视频的播放速度更改为 2 倍或 0.5 倍时,声音听起来不错。
我使用下面的代码在不改变音高的情况下简单地减慢音频:
HTML
<audio id="myHeader">
<source src="horse.mp3" type="audio/mpeg">
</audio>
<script src="script.js"></script>
Run Code Online (Sandbox Code Playgroud)
JS
var x = document.getElementById("myHeader");
function playAudio() {
x.webkitPreservesPitch = true;
x.playbackRate = 0.5;
x.play();
}
playAudio();
Run Code Online (Sandbox Code Playgroud)
它有效,但质量非常糟糕。
而且我还使用了SoundTouch.js ...
当试图将音频降低到正常速度的 50% 时,两者都工作不稳定且输出质量低,但后来我在 Javascript 中发现了Time Stretching Audio ......感谢“Jonas Wagner”即使你将音频放慢到40%。
这是Javascript 中的Time Stretching Audio的原始页面,这是一个基于网络的应用程序,它的音频质量比我尝试过的任何代码都要好得多。不幸的是,他还没有发布图书馆:(
如何将音频减慢到正常速度(保留音高)的 50% 左右,同时具有良好到卓越的质量?
这是使用TweenMax库创建简单的加载点动画的代码。
TweenMax.staggerTo(".dots", 2, {
x: 220,
backgroundColor: 'white',
repeat: -1,
ease: SlowMo.ease.config(0.5, 0.4, false)
}, 0.4);
TweenMax.staggerFrom(".dots", 2, {
opacity: 0,
scale: 0.7,
repeat: -1,
ease: SlowMo.ease.config(0.5, 0.4, true)
}, 0.4);Run Code Online (Sandbox Code Playgroud)
html {
width: 260px;
height: 32px;
overflow: hidden;
}
body {
background-color: transparent;
text-align: center;
padding: 50px;
}
.container {
background-color: transparent;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.dots {
position: absolute;
width: 1em;
height: 1em;
border-radius: 50%;
background-color: #d0c9d8;
opacity: 1;
left: -120px;
} …Run Code Online (Sandbox Code Playgroud)这是一段代码,逐字比较两个句子并返回符合某些条件的单词数:
提示:第一句中的单词 :::: 第二句中的单词
1) 保护 :::: i 应该导致不匹配
2) 保护 :::: 保护 结果应该匹配
3) 保护 :::: 保护 应该结果匹配
4) 他 :::: 我 应该结果不匹配
5) i :::: i 应该结果匹配但只有一次而不是两次:(让我解释一下)
我们有这个字符串作为第一句话:
let speechResult = "they're were protecting him i knew that i was aware";
Run Code Online (Sandbox Code Playgroud)
如您所见,它有两个i,但这里的第二句话中只有一个i:
let expectSt = ['i was sent to earth to protect you'];
Run Code Online (Sandbox Code Playgroud)
所以我们应该把这个匹配看作是一次而不是两次,如果我们在第二句话中也有两次i出现,那么我们会认为i匹配是两次。
6) was :::: was 应该结果 …
我想比较两个 JS 字符串变量。str1和str2。
str1: is the reference text. it doesn't change.
str2: is the text which can be changed to be compared with str1.
Run Code Online (Sandbox Code Playgroud)
到目前为止,我可以跟踪两个字符串之间的差异,但我想将句子本身不同部分的颜色更改为红色,如下所示:
这是输出以下内容的代码:Moon in order you
str1: is the reference text. it doesn't change.
str2: is the text which can be changed to be compared with str1.
Run Code Online (Sandbox Code Playgroud)
最好使用 jQuery 来更改文本颜色。
我把这个难看的句子用||.
const a = "they *have* a* car* sold. ||They* eat* the * good * stuff";
Run Code Online (Sandbox Code Playgroud)
我怎样才能用*或||符号分割给定的字符串,以便我们得到这个结果:
['they', 'have','a', 'car', 'sold', 'they', 'eat', 'the ', 'good ', 'stuff'];
Run Code Online (Sandbox Code Playgroud)
我不介意间距问题,我希望通过这个或那个功能进行拆分。
注意:我们可以简单地使用 a 来实现这一点,map但我想知道是否有正则表达式之类的解决方案!