我正在使用ddSlick下拉列表,因为它还有图片。当您选择一个值时,没有任何反应。如果他们被选中,如何进入facebook.com或twitter.com?这是代码:
var ddData = [
{
text: "Facebook",
value: "FB",
description: "Description with Facebook",
imageSrc: "http://dl.dropbox.com/u/40036711/Images/facebook-icon-32.png"
},
{
text: "Twitter",
value: "TWT",
description: "Description with Twitter",
imageSrc: "http://dl.dropbox.com/u/40036711/Images/twitter-icon-32.png"
}
];
$('#demoBasic').ddslick({
data: ddData,
width: 300,
imagePosition: "left",
selectText: "Select your favorite social network",
onSelected: function (data) {
console.log(data);
}
});
它使用以下文件:jquery 1.7.2.和ddslick.js
答案 0 :(得分:4)
有点快但脏,但您可以为您传递的对象添加其他属性:
var ddData = [
{
text: "Facebook",
value: "FB",
description: "Description with Facebook",
imageSrc: "http://dl.dropbox.com/u/40036711/Images/facebook-icon-32.png",
url:"http://www.facebook.com"
},
{
text: "Twitter",
value: "TWT",
description: "Description with Twitter",
imageSrc: "http://dl.dropbox.com/u/40036711/Images/twitter-icon-32.png",
url:"http://www.twitter.com"
}
];
$('#demoBasic').ddslick({
data: ddData,
width: 300,
imagePosition: "left",
selectText: "Select your favorite social network",
onSelected: function (data) {
window.location = data.selectedData.url;
}
});