1
jQuery UI 슬라이더를 사용하고 슬라이더가 특정 값에 도달했을 때 div를 표시하려고하고 그렇지 않으면 div를 표시하려고합니다. div가 예기치 않은 순간에 표시되거나 숨겨집니다. 누구든지 내가 구문이 잘못되어 가고있는 곳을 찾아 낼 수 있습니까? 다음은 스크립트의 :jquery UI 슬라이더의 값을 기준으로 div 표시/숨기기
$(function() {
//vars
var conveyor = $(".content-conveyor", $("#sliderContent")),
item = $(".item", $("#sliderContent"));
//set length of conveyor
conveyor.css("width", item.length * parseInt(item.css("width")));
//config
var sliderOpts = {
max: (item.length * parseInt(item.css("width"))) - parseInt($(".viewer", $("#sliderContent")).css("width")),orientation: "vertical",range: "min",step: 304,
slide: function(e, ui) {
conveyor.css("left", "-" + ui.value + "px");
$("#amount").val('$' + ui.value);
// here's where I'm trying to show and hide a div based on the value of the slider
if ($("#slider").slider("value") == 304) {
$("#test").show();
} else {
$("#test").hide();
}
}
};
//create slider
$("#slider").slider(sliderOpts);
$("#amount").val('$' + $("#slider").slider("value"));
});
어쨌든하지만 덕분에 작동하지 않는 - 나는 그것을 멀리 연결하겠습니다! 그 어떤 빛을 비춰 경우 : 데모 페이지가 여기에 있습니다 : 내가 기회를 얻을 때 이 http://www.andycantillon.com/slider_sourcefiles/slider.html –
멋진, 나는 면밀한 관찰을해야합니다 :)를 –
감사합니다 야, 너 멋지다! –