您的排队缺少操作
试试这个:
/**
* Enqueue audiosynth.
*/
function chicken_wings_scripts() {
wp_enqueue_script( \'audiosynth\', get_theme_file_uri( \'/js/audiosynth.js\' ), array(), filemtime( get_theme_file_path( \'/js/audiosynth.js\' ) ), true );
}
add_action( \'wp_enqueue_scripts\', \'chicken_wings_scripts\' );
-----EDIT FULL WORKING ANSWER-----执行完全相同的步骤<假设您的主题名称为
mytheme.
内部
mytheme 文件夹,您应该找到
js
folder, 如果没有人创建
js
folder.
内部
js
folder 或
mytheme, 添加3个
empty 文件:
1-
audiosynth.js
2-
audiosynth.view.js
3-
audiosynth.view.fire.js
在第一个文件中
audiosynth.js
, 复制并粘贴下载内容
audiosynth.js
文件
在第二个文件中
audiosynth.view.js
, 复制并粘贴的内容
this file.
在第三个文件中
audiosynth.view.fire.js
,
ADD ONLY 以下代码:
var a = new AudioSynthView();
a.draw();
现在,打开
functions.php
属于
mytheme 并添加以下代码:
/**
* Enqueue audiosynth.
*/
function audiosynth_scripts() {
wp_enqueue_script( \'audiosynth\', get_theme_file_uri( \'/js/audiosynth.js\' ), array(), filemtime( get_theme_file_path( \'/js/audiosynth.js\' ) ), false );
wp_enqueue_script( \'audiosynth.view\', get_theme_file_uri( \'/js/audiosynth.view.js\' ), array(), filemtime( get_theme_file_path( \'/js/audiosynth.view.js\' ) ), false );
wp_enqueue_script( \'audiosynth.view.fire\', get_theme_file_uri( \'/js/audiosynth.view.fire.js\' ), array(), filemtime( get_theme_file_path( \'/js/audiosynth.view.fire.js\' ) ), true );
}
add_action( \'wp_enqueue_scripts\', \'audiosynth_scripts\' );
现在,打开
style.css
文件内部
mytheme 并在末尾添加以下内容:
.key {
position: absolute;
font-family: Helvetica;
font-weight: 100;
font-size: 12px;
border: 1px solid rgba(32, 32, 32, 0.2);
border-radius: 0px 0px 5px 5px;
cursor: pointer;
box-shadow: 0px 5px 1px rgba(32, 32, 32, 0.2);
-webkit-transition: margin 0.05s ease, background-color 0.05s ease, box-shadow 0.05s ease;
}
.key:hover {
background-color: rgb(255, 192, 32);
}
.key .label {
position: absolute;
bottom: 5px;
text-align: center;
left: 0px;
right: 0px;
}
.black {
background-color: rgb(32, 32, 32);
color: #ffffff;
z-index: 1;
text-shadow: 0px -1px 1px rgba(255, 255, 255, 0.5);
}
.white {
background-color: #ffffff;
color: rgb(32, 32, 32);
z-index: 0;
text-shadow: 0px 1px 1px rgba(32, 32, 32, 0.5);
}
.keyboard-options {
margin: 30px auto;
width: auto;
text-align: center;
font-size: 12px;
font-weight: 200;
padding: 10px;
}
.keyboard-holder {
margin: 30px auto;
height: 200px;
position: relative;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-o-user-select: none;
}
现在,您应该添加以下代码,比如在
header.php
内部的文件
mytheme.
请勿将此代码放入
<?php ?>
tag,这是
HTML
:
<select ID="sound">
<option value="0" selected>Keyboard</option>
<option value="1">Organ</option>
<option value="2">Acoustic Guitar</option>
<option value="3">EDM, bro!</option>
</select>
<div ID="keyboard" class="keyboard-holder"></div>
<div class="keyboard-options">
Range [C<span ID="OCTAVE_LOWER">3</span>-B<span ID="OCTAVE_UPPER">5</span>]
<input type="button" ID="-_OCTAVE" value="-" />
<input type="button" ID="+_OCTAVE" value="+" /><br />
<i>(Use left/right arrows to adjust with keyboard)</i>
</div>
现在,去你的网站,刷新页面和tada!!!
SYA:)