I have the following snippet of code:
Which reads:
HTML:
<div id="secrets-slider"></div>
CSS:
#secrets-slider {
position: relative;
left: 50%;
top:50px;
height: 200px;
}
.ui-state-default, .ui-widget-content .ui-state-default {
background: red;
}
Javascript:
var flash = 1;
$(function () {
$("#secrets-slider").slider({
orientation: "vertical",
range: "min",
min: 0,
max: 100,
value: 70,
animate: 3000,
slide: function (event, ui) {
$("#amount").val(ui.value);
flash=0;
},
});
function flashing() {
if (flash === 0) {
$("#secrets-slider a").stop(true, true);
} else {
$("#secrets-slider a").animate(
{
backgroundColor: '#ff8c00'
}, 1000,
function() {
$("#secrets-slider a").animate(
{
backgroundColor: '#f00'
}, 1000
)
}
)
setTimeout(flashing,2000);
}
}
flashing();
});
Now I implement this code into a website I am trying to make for a friend. Available here: http://blah.eu5.org/
When I add this code, it doesn’t seem to function. Noticably, the jquery slider handle doesn’t pulse at all. I have checked that the event is firing with alert("Moo"); and it is, but it doesn’t seem to be altering the CSS. Why might this be?
After a lot of headaches, I figured out that using
.animate()on a background is actually part of the JQuery UI plugin, and I was using a minimalised version of the UI plugin which didn’t include this code(pretty much had the slider and that was it).Let that be a lesson to me.