我的jQuery循环幻灯片不起作用。我用html编写了脚本,但是我不知道如何使它工作。
int numFrequencies = fftSamples.length / 2;
double[] spectrum = new double[numFrequencies];
for(int k = 1; k < numFrequencies; k++) {
spectrum[k] = Math.sqrt(Math.pow(fftSamples[k*2], 2) + Math.pow(fftSamples[k*2+1], 2));
}
spectrum[0] = fftSamples[0];
int NUM_BANDS = 20; //This can be any positive integer.
double[] bands = new double[NUM_BANDS];
int samplesPerBand = numFrequencies / NUM_BANDS;
for(int i = 0; i < NUM_BANDS; i++) {
//Add up each part
double total;
for(int j = samplesPerBand * i ; j < samplesPerBand * (i+1); j++) {
total += spectrum[j];
}
//Take average
bands[i] = total / samplesPerBand;
}
//Use bands in view!
$("#next").click(function() {
$(".cycle-slideshow").cycle('next');
});
$("#prev").click(function() {
$(".cycle-slideshow").cycle('prev');
});
.body-content {
width: 100%;
min-height: 100px;
float: left;
margin-top:25px;
}
.content-left{
width:63%;
float: left;
display: inline-block;
}
.content-right {
width: 34%;
float: right;
display: inline-block;
padding: 5px;
background-color: blue;
}
.slider {
width: 100%;
float: left;
display: inline-block;
position: relative;
}
.cycle-slideshow {
position: relative;
}
.cycle-overlay {
position: absolute;
bottom: 0;
left: 0;
background-color: #000;
color: #fff;
width: 100%;
display: inline-block;
line-height: 24px;
padding-left: 5px;
box-sizing: border-box;
}
.slider-control {
position: absolute;
top:25%;
z-index: 1000;
width: 100%;
}
.slider-control span {
width: 35px;
height: 35px;
display: inline-block;
text-align: center;
line-height: 35px;
background-color: #1111e1;
color: #fff;
cursor: pointer;
}
.slider-control span#next {
float: right;
}
.slider-control span#prev {
float: left;
}