1
當單擊單選按鈕時,我需要一個新的滑塊圖像 但它以某種方式保留舊圖像選擇並與新圖像連接。基於wp網站上的按鈕的滑塊
<script>
$(document).ready(function() {
$('input:radio').change(function() {
var count = 0;
var image = $('#pg-48-0> .panel-row-style');
if (this.value == 'camping') {
var images={};
images = [ "http://development.tripoutside.com/wp-content/uploads/2017/05/camping.jpg"];
}
else if (this.value == 'road-sports') {
var images={};
images = [ "http://development.tripoutside.com/wp-content/uploads/2017/05/bikes.jpg",
"http://development.tripoutside.com/wp-content/uploads/2017/05/bike2.jpg",
"http://development.tripoutside.com/wp-content/uploads/2017/05/bike3.jpg"];
}
else if (this.value == 'snow-sports') {
}
else if (this.value == 'water-sports') {
}
setInterval(function(){
image.css("background-image","url("+images[count++]+")");
if(count == images.length)
{
count = 0;
}
},5000);
});
});
</script>
這裏是鏈接到網站:http://development.tripoutside.com/
要設置css屬性,您應該寫入$(images).css()。請嘗試。 – MehulJoshi