标签:
个人电脑里存了不少适合手机欣赏的图片,但是放手机里看是件很占据资源的事。鉴于家里有一台电脑经常开着,正好用来做家庭局域网共享,于是笔者就设想通过一种比较简单环保的思路。通过手机访问电脑内的图片。
首先是本地站点搭建:win+R输入mmc打开控制台,文件-添加/删除管理单元,Internet信息服务。添加确定,右侧基本信息,新建网站-把路径改了。设定一个端口号,手机浏览器就可以输入 电脑局域网ip:端口号 就可以连上去了。
代码清单html
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
<!DOCTYPE html> < html lang = "zh-cn" > < head > <!--页面编码 --> < meta charset = "UTF-8" > <!--低版本浏览器模拟渲染--> < meta name = "viewport" content=" width = device -width, initialscale = 1 , maximumscale = 1 , user-scalable = no "> < meta name = "viewport" content = "width=deviece-width,initial-scale=1" > <!--支持国产浏览器的高速渲染--> < meta name = "renderer" content = "Webkit" > <!--在此进行SEO设置:作者、关键词、描述--> < meta name = "author" content = "djtao" > < meta name = "keywords" content = "djtao" > < meta name = "description" content = "djtao" > < title >Ugirl</ title > <!--bootstrap--> <!--以下两个js插件用于在IE8及以下支持H5元素查询的,如不用可移除 --> <!--[if lt IE 9]> <script src="scripts/html5.min.js"></script> <script src="scripts/respond.min.js"></script> <![endif]--> <!--bootstrap样式文件 --> < link rel = "stylesheet" href = "bootstrap/css/bootstrap.css" > <!--自定义样式文件 --> < link rel = "stylesheet" href = "styles/css.css" > <!--基于jQuery的脚本文件 --> < script src = "scripts/jquery.min.js" ></ script > <!-- bootstrap的jq插件 --> < script src = "bootstrap/js/bootstrap.min.js" ></ script > <!--自定义脚本文件 --> < script src = "scripts/js.js" ></ script > </ head > < body class = "container" > < header > < h1 >Ugirl < small >专业的秘密</ small ></ h1 > </ header > < div id = "main" class = "row" > < div id = "btn-group" class = "col-xs-6" > < ul id = "list" class = "list-inline" ></ ul > </ div > < div class = "col-xs-6" > < form class = "form-horizontal" > < div class = "form-group has-success" > < div class = "col-xs-6" >< input class = "form-control" id = "num" style = "width:100%" col = "2" type = "text" ></ div > < div class = "col-xs-2" >< input type = "button" value = "jump" class = "btn btn-default" > </ div > </ form > </ div > </ div > </ div > < div class = "row" > < div id = "box" class = "col-xs-12" > < div id = "last" ></ div > < div id = "next" ></ div > < img class = "img-responsive" src = "img/wenjing/wenjing (1).jpg" > </ div > </ div > </ body > </ html > |
css
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
|
body{ background : #f2f2f2 ; } #box{ position : relative ; } #next{ width : 50% ; height : 500px ; position : absolute ; left : 50% ; } #last{ width : 50% ; height : 500px ; position : absolute ; } #btn-group{ height : 40px ; overflow : hidden ; } #list{ list-style : none ; position : absolute ; } #list>li{ list-style : none ; float : left ; position : relative ; } #main{ margin-top : 20px ; } |
javascript
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
function Ugirl(url,imgNum){ var aBtn=document.getElementsByTagName( ‘button‘ ); $( ‘#list‘ ).css( ‘width‘ ,(imgNum*(52))+ ‘px‘ ); var str=url; var index=0; for (i=0;i<str.length;i++){ if (str.slice(i-1,i)== ‘(‘ ){ index=i; } } var a=str.slice(0,index); var b=str.slice(index); //分割url字符串 for (j=1;j<=imgNum;j++){ var $btn = $( ‘<li><button class="btn btn-primary">‘ +j+ ‘</button></li>‘ ); $btn.appendTo($( ‘#list‘ )); } aBtn[0].className= ‘btn btn-danger‘ ; //按钮初始化设置 //手指点击事件 $( ‘#box div‘ ).click( function (){ if ($( this ).attr( ‘id‘ )== ‘next‘ ){ //下一个 if ($( ‘.btn-danger‘ ) .html()==imgNum){ alert( ‘到底了哦‘ ); return false ; } liWidth=44; liWidth2=52; $( ‘.btn-danger‘ ).removeClass().addClass( ‘btn btn-primary‘ ) .parent().next().children().removeClass().addClass( ‘btn btn-danger‘ ); } else if ($( this ).attr( ‘id‘ )== ‘last‘ ){ //上一个 if ($( ‘.btn-danger‘ ) .html()==1){ alert( ‘到顶了哦‘ ); return false ; } else { $( ‘.btn-danger‘ ).removeClass().addClass( ‘btn btn-primary‘ ) .parent().prev().children().removeClass().addClass( ‘btn btn-danger‘ ); liWidth=-44; liWidth2=-52; } } else { return false ; }; //个位数按钮和10位数按钮宽度不同。所以设置两个 if ($( ‘.btn-danger‘ ) .html()<=10){ $( ‘#list‘ ).animate({left: ‘-=‘ +liWidth+ ‘px‘ },400); } else if ($( ‘.btn-danger‘ ) .html()>10){ $( ‘#list‘ ).animate({left: ‘-=‘ +liWidth2+ ‘px‘ },400); } //大图切换 $( ‘img‘ ).fadeOut(200); setTimeout( function (){ $( ‘img‘ ).attr( ‘src‘ ,a+$( ‘.btn-danger‘ ) .html()+b); },220) $( ‘img‘ ).fadeIn(300); }); //选项按钮点击 $( ‘button‘ ).click( function (){ $( ‘button‘ ).attr( ‘class‘ , ‘btn btn-primary‘ ); $( this ).attr( ‘class‘ , ‘btn btn-danger‘ ); var moveLength=-$( this ).parent().position().left+15; $( ‘#list‘ ).animate({left:moveLength+ ‘px‘ },400); $( ‘img‘ ).attr( ‘src‘ ,a+$( ‘.btn-danger‘ ) .html()+b); }); //跳转按钮点击 $( ‘.btn-default‘ ).click( function (){ var s=$( ‘#num‘ ).val(); if (s<1||s>imgNum){ return false ; alert( ‘没有那么多哦‘ ) } //极限设置 var pageNum=$( ‘.btn-danger‘ ) .html(); $( ‘img‘ ).attr( ‘src‘ ,a+s+b); $( ‘#list‘ ).children().children().removeClass().addClass( ‘btn btn-primary‘ ); $(aBtn[s-1]).removeClass().addClass( ‘btn btn-danger‘ ); var moveLength=-$(aBtn[s-1]).parent().position().left+15; $( ‘#list‘ ).animate({left:moveLength+ ‘px‘ },400); }) } $( function (){ Ugirl( ‘img/wenjing/wenjing ().jpg‘ ,65); }) //在其它页面也引入了Ugirl函数后,就可以直接调用直接调用 |
标签:
原文地址:http://www.cnblogs.com/djtao/p/5955056.html