<!DOCTYPEhtml PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head> <title></title> <scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script> <scriptsrc="Scripts/jquery.ddslick.js" type="text/javascript"></script> <scripttype="text/javascript"> $(function () { var ddlData = [ { text: "Lwolf", value: 1, selected: false, description: "描述", imageSrc: "/Content/image/1_f.gif" }, { text: "Site518", value: 2, selected: true, description: "", imageSrc: "/Content/image/2_f.gif" } ]; alert(ddlData); $(‘#mydropdown‘).ddslick({ data: ddlData, width: 150, showSelectedHTML:true, selectText: "请选择...", imagePosition: "left", onSelected: function (selectedData) { //回调方法 } }); }) </script></head><body><divid="mydropdown"></div></body></html> |
To use this control, you need to refer to jquery first. I do not know if he has requirements for the jquery version, I quote 1.4.4, this control can not run, reference 1.7.2.
Basically, it's simple, but one thing is: if you don't need that JSON description in the process, it can be empty, but it seems like a bit of a problem after writing it.
Will show up like this:
The picture and the word shown above are not on the same line. I looked at his CSS and found that when there was no description he used a line-height:40px for that font, and it was centered, and the picture was not. So I found the following code in his jquery code:
Comment out this section to OK.
The final effect is good, such as:
A nice-looking drop-down control that can be inserted into a picture