欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JS仿Windows實(shí)現(xiàn)桌面主題特效

 更新時(shí)間:2022年06月09日 09:36:29   作者:海擁  
這篇文章主要介紹了如何利用HTML+CSS+JS模仿Windows實(shí)現(xiàn)桌面主題特效,文中的示例代碼講講詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下

實(shí)現(xiàn)效果

在線演示地址:https://haiyong.site/win

項(xiàng)目基本結(jié)構(gòu)

目錄結(jié)構(gòu)如下:

HTML代碼

HTML 主要代碼:

<a  rel="external nofollow"  class="powered_by">Powered by haiyong.site 注意:雙擊桌面應(yīng)用即可點(diǎn)開</a>
<ul id="deskIcon">
  <li class="desktop_icon" id="win11" path="https://haiyong.site/"> <span class="icon"><img src="icon/icon14.png"/></span>
    <div class="text">海擁
      <div class="right_cron"></div>
    </div>
  </li>
 <li class="desktop_icon" id="win11" path="https://haiyong.blog.csdn.net/"> <span class="icon"><img src="icon/csdn.png"/></span>
   <div class="text">CSDN
     <div class="right_cron"></div>
   </div>
 </li>
  <li class="desktop_icon" id="win11" path="https://juejin.cn/user/2040341402229751"> <span class="icon"><img src="icon/juejin.png"/></span>
    <div class="text">掘金
      <div class="right_cron"></div>
    </div>
  </li>  
  <li class="desktop_icon" id="win11" path="https://space.bilibili.com/63551025"> <span class="icon"><img src="icon/bilibili.png"/></span>
    <div class="text">bilibili
      <div class="right_cron"></div>
    </div>
  </li>  
</ul>
<div id="taskBar">
  <div id="leftBtn"><a href="#" rel="external nofollow"  rel="external nofollow"  class="upBtn"></a></div>
  <div id="rightBtn"><a href="#" rel="external nofollow"  rel="external nofollow"  class="downBtn"></a> </div>
  <div id="task_lb_wrap">
    <div id="task_lb"></div>
  </div>
</div>
<div id="lr_bar">
  <ul id="default_app">
    <li id="app0"><img src="icon/icon1.png" title="海擁" path="https://haiyong.site/"/></li>
    <li  id="app2"><img src="icon/icon0.png" title="工具" path="https://haiyong.site/tools"/></li>
    <li id="app3"><img src="icon/icon2.png" title="交流群" path="https://app.yinxiang.com/fx/8aa8eb1b-7d45-4793-a160-b990d9da2e75"/></li>
    <li id="app4"> <img src="icon/icon3.png" title="聯(lián)系作者" path="https://haiyong.site/img/qrcode/weixin.png"/></li>
    <li id="app1"><img src="icon/icon11.png" title="Jquery學(xué)堂" path="http://www.jq22.com/?Jquery.aspx"/></li>
  </ul>
  <div id="default_tools"> <span id="showZm_btn" title="顯示桌面"></span><span id="shizhong_btn" title="時(shí)鐘"></span><span id="weather_btn" title="天氣"></span> <span id="them_btn" title="主題"></span></div>
  <div id="start_block"> <a title="開始" id="start_btn"></a>
    <div id="start_item">
      <ul class="item admin">
        <li><span class="adminImg"></span> Admin</li>
      </ul>
      <ul class="item">
        <li><span class="sitting_btn"></span>系統(tǒng)設(shè)置</li>
        <li><span class="help_btn"></span>使用指南 <b></b></li>
        <li><span class="about_btn"></span>關(guān)于我們</li>
        <li><span class="logout_btn"></span>退出系統(tǒng)</li>
      </ul>
    </div>
  </div>
</div>
</div>

CSS 代碼

CSS主要代碼:

body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, textarea, p, blockquote, th, td {
	margin:0;
	padding:0;
}
table {
	border-collapse:collapse;
	border-spacing:0;
}
fieldset, img {
	border:0;
}
address, caption, cite, code, dfn, em, strong, th, var {
	font-style:normal;
	font-weight:normal;
}
ol, ul, li {
	list-style:none;
}
caption, th {
	text-align:left;
}
h1, h2, h3, h4, h5, h6 {
	font-size:100%;
	font-weight:normal;
}
q:before, q:after {
	content:”;
}
abbr, acronym {
	border:0;
}
* {
	margin:0;
	padding:0
}

頁面基礎(chǔ)樣式

/*頁面基礎(chǔ)樣式*/
html {
	overflow:hidden;
}
body {
	font-size: 12px;
	background:#06C url(wallpapers/menglong2.jpg) repeat scroll center center;
	font-family: Tahoma, Geneva, sans-serif;
	margin:0;
	padding:0
}
a {
	font-size: 12px;
}
a:link {
	text-decoration: none;
	color: #FFF;
}
a:visited {
	text-decoration: none;
	color: #FFF;
}
a:hover {
	text-decoration: none;
	color: #FFF;
}
a:active {
	text-decoration: none;
	color: #FFF;
}
.corner {/*只在支持css3的高級(jí)瀏覽器起作用*/
	-moz-border-radius: 5px;
	-webkit-border-radius: 5px;
	border-radius: 5px;
	-moz-box-shadow: 2px 2px 8px #444;
	-webkit-box-shadow: 2px 2px 8px #444;
	box-shadow:2px 2px 8px #444;
}
.loading {
	background:url(images/loading.gif) no-repeat center center
}

界面布局樣式

/*界面布局樣式*/
.powered_by {
	width:160px;
	height:25px;
	line-height:25px;
	background:url(images/powered-by.png) no-repeat left center;
	color:#CCC;
	text-indent:26px;
	display:block;
	outline:none;
	position:absolute;
	right:20px;
	bottom:60px;
}

任務(wù)欄樣式

#taskBar {
	width:100%;
	height:40px;
	line-height:40px;
	position:absolute;
	right:0;
	bottom:0;
}
#leftBtn {
	width:100px;
	height:40px;
	float:left;
	display:none;
}
#rightBtn {
	width:100px;
	height:40px;
	float:right;
	display:none;
}
#leftBtn a, #rightBtn a {
	display:block;
	width:100px;
	height:40px;
	outline:none;
	background-image:url(images/lr_btn.png);
	background-repeat:no-repeat;
}
#leftBtn a {
	background-position:left top;
}
#rightBtn a {
	background-position:right top;
}
#leftBtn a:hover {
	background-position:left bottom
}
#rightBtn a:hover {
	background-position:right bottom
}
#task_lb_wrap {
	height:40px;
	line-height:40px;
	overflow:hidden;
	position:relative;
}
#task_lb {
	width:auto;
	height:auto;
	position:absolute;
	top:0;
	right:0;
}
#task_lb a {
	display:inline-block;
	outline:none;
	width:100px;
	height:40px;
	background-image:url(images/taskHdBtn.png);
	background-repeat:no-repeat;
	text-align:center;
	line-height:40px;
	float:right
}
#task_lb .defaultTab {
	background-position:right top;
	color:#ccc
}
#task_lb .defaultTab:hover {
	background-position:right bottom;
}
#task_lb .selectTab {
	background-position:left top;
	color:#FFF
}
#task_lb .selectTab:hover {
	background-position:left bottom
}
#shizhong_btn {
	background:url(images/timer.png) no-repeat center center
}
#weather_btn {
	background:url(images/wheather.png) no-repeat center center
}
#sound_btn {
	background:url(images/sound_open.png) no-repeat center center
}
#showZm_btn {
	background:url(images/show-desktop.png) no-repeat center center
}
#them_btn {
	background:url(images/skin.png) no-repeat center center
}

側(cè)邊浮動(dòng)欄

#lr_bar {
	width:73px;
	height:auto;
	position:absolute;
	left:0;
	top:30px;
	background:url(images/dock_top.png) repeat-y left top;
	z-index:90;
	-moz-box-shadow: 0px 3px 15px #444;
	-webkit-box-shadow: 0px 3px 15px #444;
	box-shadow:0px 3px 15px #444;
	padding-top:5px;
}

開始按鈕樣式

#start_block {
	width:73px;
	height:56px;
	position:absolute;
	left:0;
	bottom:-56px;
	background:url(images/dock_b.png) no-repeat left bottom;
	-moz-box-shadow: 0px 5px 15px #444;
	-webkit-box-shadow: 0px 5px 15px #444;
	box-shadow:0px 5px 15px #444;
}
#start_btn {
	display:block;
	width:48px;
	height:48px;
	background:url(images/start-btn.png) no-repeat center bottom;
	margin:4px auto 0 auto;
	outline:none;
	z-index:501;
	cursor:pointer;
}
#start_btn:hover {
	background-position:center top
}

開始菜單樣式

#start_item {
	width:180px;
	height:auto;
	padding:5px 0;
	background: url(images/start_item_bg.png) repeat;
	position:absolute;
	z-index:500;
	left:75px;
	bottom:0px;
	display:none;
	-moz-border-radius: 5px;
	-webkit-border-radius: 5px;
	border-radius: 5px;
	-moz-box-shadow: 2px 2px 5px #444;
	-webkit-box-shadow: 2px 2px 5px #444;
	box-shadow:2px 2px 5px #444;
}
#start_item .item {
	width:100%;
	height:auto;
	border-top:1px solid #999
}
#start_item .item li {
	width:98%;
	height:24px;
	overflow:hidden;
	zoom:-1;
	padding:6px 0;
	line-height:24px;
	margin:0 auto;
	color:#FFF;
}
#start_item .item li:hover {
	background:url(images/start_item_over.png) repeat-x left bottom;
	cursor:pointer
}
#start_item .item li span {
	display:inline-block;
	width:24px;
	height:24px;
	background-image:url(images/start_itembtn.png);
	background-repeat:no-repeat;
	margin:0 10px;
	float:left;
}
#start_item .item li b {
	width:10px;
	height:24px;
	background:url(images/item-child.png) no-repeat center center;
	display:inline-block;
	float:right;
	margin-right:10px;
}
#start_item .sitting_btn {
	background-position:left -140px;
}
#start_item .help_btn {
	background-position:left -44px;
}
#start_item .about_btn {
	background-position:left -164px;
}
#start_item .logout_btn {
	background-position:left -20px;
}
#start_item .admin {
	border-bottom:1px solid #444;
	padding:5px 0;
	border-top:none;
}
#start_item .item li .adminImg {
	border:1px solid #E0E0E0;
	background-position:left -92px;
	background-color:#FFF;
}

默認(rèn)小工具

#default_tools {
	width:71px;
	height:auto;
	overflow:hidden;
	zoom:-1;
	padding:5px 0;
	border-top:1px solid #555;
	margin:0 auto;
}
#default_tools span {
	width:30px;
	height:30px;
	display:inline-block;
	margin:0 0 0 3px;
	cursor:pointer;
	float:left;
}

默認(rèn)應(yīng)用程序

#default_app {
	width:73px;
	height:auto;
	padding:5px 0;
	position:relative;
}
#default_app li {
	width:48px;
	height:48px;
	overflow:hidden;
	margin:3px auto;
	padding:6px;
}
#default_app li img {
	width:48px;
	height:48px;
	cursor:pointer;
}
#default_app .btnOver {
	background:url(images/default_appbtn_bg.png) no-repeat center center
}

重寫右鍵菜單樣式

.smart_menu_box .smart_menu_a {
	color:#333
}
.smart_menu_box .smart_menu_li_separate {
	border-bottom:1px solid #d6d5d5;
}

窗口樣式

.windows {
	min-width:240px;
	min-height:200px;
	width:700px;
	height:560px;
	position:absolute;
	display:none;
	background-color:#E0E0E0;
}
.win_title {
	width:100%;
	height:26px;
	line-height:26px;
	background:#E0E0E0 url(images/titlebar_bg_cur.png) repeat-x left center;
	-moz-border-radius: 5px;
	-webkit-border-radius: 5px;
	border-radius: 5px;
}
.win_title b {
	color:#333;
	margin-left:10px;
}
.win_title .win_btnblock {
	width:auto;
	padding:0 5px;
	float:right;
	height:17px;
	margin:4px 3px 0 0;
}
.win_title .win_btnblock a {
	display:inline-block;
	width:26px;
	height:17px;
	background-image:url(images/windowBtn.png);
	background-repeat:no-repeat;
	float:left;
	margin:0 1px;
	outline:none;
}
.winMaximize {
	background-position:right bottom;
}
.winMaximize:hover {
	background-position:right top;
}
.winHyimize {
	background-position:-26px bottom;
}
.winHyimize:hover {
	background-position:-26px top;
}
.winClose {
	background-position:-52px top;
}
.winClose:hover {
	background-position:-52px bottom;
}
.winMinimize {
	background-position:left bottom;
}
.winMinimize:hover {
	background-position:left top;
}
.winframe {
	width:100%;
	height:auto;
	margin:0 0 0 3px;
	padding:0
}

桌面圖標(biāo)

#deskIcon {
	width:100%;
	height:auto;
	overflow:hidden;
	zoom:-1;
	position:relative;
}
.desktop_icon {
	width:86px;
	height:88px;
	cursor:pointer;
	margin-left:-1000px;
	text-align:center;
}
.desktop_icon span {
	display:block;
}
.desktop_icon .icon {
	width:50px;
	height:50px;
	margin:5px auto;
}
.desktop_icon .icon img {
	width:50px;
	height:50px;
}
.desktop_icon .text {
	display:inline-block;
	width:auto;
	height:22px;
	line-height:22px;
	text-align:center;
	color:#fff;
	background:url(images/iconTextbg.png) no-repeat left center;
	position:relative;
	padding-left:10px;
	margin-right:10px;
}
.desktop_icon .right_cron {
	width:10px;
	height:22px;
	position:absolute;
	right:-10px;
	top:0;
	background:url(images/iconTextbg_right.png) left center no-repeat;
}
.desktop_icon_over {
	background:url(images/icon_over.png) no-repeat center center;
}

JS 代碼

JS代碼較多這里只展示部分JS代碼,完整源碼可在文末獲取

//聲明desktop空間,封裝相關(guān)操作
myLib.NS("desktop");
myLib.desktop={
	winWH:function(){
		$('body').data('winWh',{'w':$(window).width(),'h':$(window).height()});
 	},
	desktopPanel:function(){
		$('body').data('panel',{
					   'taskBar':{
					   '_this':$('#taskBar'),
					   'task_lb':$('#task_lb')
										},
					   'lrBar':{
					   '_this':$('#lr_bar'),	   
					   'default_app':$('#default_app'),
				       'start_block':$('#start_block'),
				       'start_btn':$('#start_btn'),
					   'start_item':$('#start_item'),
					   'default_tools':$('#default_tools')
							},				
						'deskIcon':{
							'_this':$('#deskIcon'),
							'icon':$('li.desktop_icon')
							},
						'powered_by':$('a.powered_by')
						});
		},
	getMydata:function(){
		return $('body').data();
		},
	mouseXY:function(){
		var mouseXY=[];
		$(document).bind('mousemove',function(e){
			mouseXY[0]=e.pageX;
			mouseXY[1]=e.pageY;
           });
		return mouseXY;
		},
	contextMenu:function(jqElem,data,menuName,textLimit){
		  var _this=this
		      ,mXY=_this.mouseXY();

          jqElem
		  .smartMenu(data,{
            name: menuName,
			textLimit:textLimit,
			afterShow:function(){
				var menu=$("#smartMenu_"+menuName);
				var myData=myLib.desktop.getMydata(),
		            wh=myData.winWh;//獲取當(dāng)前document寬高
 				var menuXY=menu.offset(),menuH=menu.height(),menuW=menu.width();
				if(menuXY.top>wh['h']-menuH){
					menu.css('top',mXY[1]-menuH-2);
					}
				if(menuXY.left>wh['w']-menuW){
					menu.css('left',mXY[0]-menuW-2);
					}
				}
           });
		  $(document.body).click(function(event){
			event.preventDefault(); 			  
			$.smartMenu.hide();
						  });
		}
	}

GitHub 地址:https://github.com/wanghao221/moyu

以上就是JS仿Windows實(shí)現(xiàn)桌面主題特效的詳細(xì)內(nèi)容,更多關(guān)于JS桌面主題特效的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • JavaScript判斷密碼強(qiáng)度(自寫代碼)

    JavaScript判斷密碼強(qiáng)度(自寫代碼)

    網(wǎng)站注冊(cè)的時(shí)候經(jīng)常可以看到密碼強(qiáng)度提示,今天自己做了一個(gè)JS密碼強(qiáng)度判斷,具體實(shí)現(xiàn)如下,喜歡的朋友可以學(xué)習(xí)下
    2013-09-09
  • JavaScript中三種觀察者實(shí)現(xiàn)案例分享

    JavaScript中三種觀察者實(shí)現(xiàn)案例分享

    前面突然看到 Object.defineProperty,就順道想到 Proxy,然后就想到了觀察者案例,這邊還沒有用 javascript編寫一個(gè)觀察者的案例呢,順道加入了一個(gè) event-bus 監(jiān)聽事件案例,湊一起看一看不同的實(shí)現(xiàn)方式,需要的朋友可以參考下
    2023-08-08
  • SharePoint 客戶端對(duì)象模型 (一) ECMA Script

    SharePoint 客戶端對(duì)象模型 (一) ECMA Script

    今天開始SharePoint Client對(duì)象模型的介紹,簡(jiǎn)而言之,SharePoint通過WCF技術(shù)在服務(wù)端提供數(shù)據(jù)服務(wù),這些服務(wù)提供的內(nèi)容相當(dāng)于SharePoint API的一個(gè)子集
    2011-05-05
  • 微信小程序頁面渲染實(shí)現(xiàn)方法

    微信小程序頁面渲染實(shí)現(xiàn)方法

    這篇文章主要介紹了微信小程序頁面渲染實(shí)現(xiàn)方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-11-11
  • 動(dòng)態(tài)生成js類的實(shí)現(xiàn)方法

    動(dòng)態(tài)生成js類的實(shí)現(xiàn)方法

    動(dòng)態(tài)生成js類的實(shí)現(xiàn)方法...
    2007-03-03
  • JS中splice添加或刪除數(shù)組元素

    JS中splice添加或刪除數(shù)組元素

    本文主要介紹了JS中splice添加或刪除數(shù)組元素,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-12-12
  • js-FCC算法-No repeats please字符串的全排列(詳解)

    js-FCC算法-No repeats please字符串的全排列(詳解)

    下面小編就為大家?guī)硪黄猨s-FCC算法-No repeats please字符串的全排列(詳解)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-05-05
  • 用 javascript 實(shí)現(xiàn)的點(diǎn)擊復(fù)制代碼

    用 javascript 實(shí)現(xiàn)的點(diǎn)擊復(fù)制代碼

    用 javascript 實(shí)現(xiàn)的點(diǎn)擊復(fù)制代碼,需要的朋友可以參考一下
    2007-03-03
  • JavaScript實(shí)現(xiàn)excel文件導(dǎo)入導(dǎo)出

    JavaScript實(shí)現(xiàn)excel文件導(dǎo)入導(dǎo)出

    這篇文章主要介紹了JavaScript實(shí)現(xiàn)excel文件導(dǎo)入導(dǎo)出,文件的導(dǎo)入導(dǎo)出是非常常見的需求功能,excel文件的導(dǎo)入導(dǎo)出更為常見,實(shí)踐中許多時(shí)候,是調(diào)用接口實(shí)現(xiàn)導(dǎo)入導(dǎo)出的,具體實(shí)現(xiàn)內(nèi)容需要的小伙伴可以參考一下
    2022-06-06
  • js通過audioContext實(shí)現(xiàn)3D音效

    js通過audioContext實(shí)現(xiàn)3D音效

    這篇文章主要為大家詳細(xì)介紹了js通過audioContext實(shí)現(xiàn)3D音效,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-04-04

最新評(píng)論