Html
    Css
    Js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var src = "";
//
$(".list").css("background", "rgba(255,255,255,0.5)");
$(".rblist").css("background", "rgba(255,255,255,0.5)");
//list
$(".list4").css("background", "rgba(255,255,255,0.3)");
$(".rb").hide();
$(".rb4").show();
//list
$(".list").click(function() {
$(".list").css("background", "rgba(255,255,255,0.5)");
$(this).css("background", "rgba(255,255,255,0.3)");
if ($(this).attr("data-item") == "1") {
$(".rb").hide();
$(".rb1").show();
} else if ($(this).attr("data-item") == "2") {
$(".rb").hide();
$(".rb2").show();
} else if ($(this).attr("data-item") == "3") {
$(".rb").hide();
$(".rb3").show();
} else if ($(this).attr("data-item") == "4") {
$(".rb").hide();
$(".rb4").show();
}
});
$(".rblist ").click(function() {
$(".rblist").css("background", "rgba(255,255,255,0.5)");
$(this).css("background", "rgba(255,255,255,0.3)");
$(".imgfloat").show()
if ($(this).attr("data-item") == "rb1list1") {
$(".imgfloat").attr("src", "http://www.jq22.com/img/cs/500x300-1.png")
} else if ($(this).attr("data-item") == "rb1list2") {
$(".imgfloat").attr("src", "http://www.jq22.com/img/cs/500x300-2.png")
} else if ($(this).attr("data-item") == "rb2list1") {
$(".imgfloat").attr("src", "http://www.jq22.com/img/cs/500x300-3.png")
} else if ($(this).attr("data-item") == "rb2list2") {
$(".imgfloat").attr("src", "http://www.jq22.com/img/cs/500x300-4.png")
} else if ($(this).attr("data-item") == "rb3list1") {
$(".imgfloat").attr("src", "http://www.jq22.com/img/cs/500x300-5.png")
} else if ($(this).attr("data-item") == "rb3list2") {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
↑上面代码改变,会自动显示代码结果 jQuery调用版本:1.11.3
 立即下载

图片拖拽缩放

点击列表动态获取图片地址,渲染图片。
被选中列表项默认底色突出。
判断滚轮滚动方向,扩大图片或缩小图片。
body添加overflow属性,防止图片放大之后页面出现不必要的滚动条。

0