pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

      <legend id='YSFh1'><style id='YSFh1'><dir id='YSFh1'><q id='YSFh1'></q></dir></style></legend>
    1. <i id='YSFh1'><tr id='YSFh1'><dt id='YSFh1'><q id='YSFh1'><span id='YSFh1'><b id='YSFh1'><form id='YSFh1'><ins id='YSFh1'></ins><ul id='YSFh1'></ul><sub id='YSFh1'></sub></form><legend id='YSFh1'></legend><bdo id='YSFh1'><pre id='YSFh1'><center id='YSFh1'></center></pre></bdo></b><th id='YSFh1'></th></span></q></dt></tr></i><div class="4kck6i6" id='YSFh1'><tfoot id='YSFh1'></tfoot><dl id='YSFh1'><fieldset id='YSFh1'></fieldset></dl></div>

      <tfoot id='YSFh1'></tfoot>
        <bdo id='YSFh1'></bdo><ul id='YSFh1'></ul>

      1. <small id='YSFh1'></small><noframes id='YSFh1'>

        使用 javascript 旋轉(zhuǎn) div

        Rotate a div using javascript(使用 javascript 旋轉(zhuǎn) div)
        <i id='pLHdm'><tr id='pLHdm'><dt id='pLHdm'><q id='pLHdm'><span id='pLHdm'><b id='pLHdm'><form id='pLHdm'><ins id='pLHdm'></ins><ul id='pLHdm'></ul><sub id='pLHdm'></sub></form><legend id='pLHdm'></legend><bdo id='pLHdm'><pre id='pLHdm'><center id='pLHdm'></center></pre></bdo></b><th id='pLHdm'></th></span></q></dt></tr></i><div class="auuyamm" id='pLHdm'><tfoot id='pLHdm'></tfoot><dl id='pLHdm'><fieldset id='pLHdm'></fieldset></dl></div>
          1. <small id='pLHdm'></small><noframes id='pLHdm'>

              <bdo id='pLHdm'></bdo><ul id='pLHdm'></ul>
                <tbody id='pLHdm'></tbody>

                <tfoot id='pLHdm'></tfoot>

                  <legend id='pLHdm'><style id='pLHdm'><dir id='pLHdm'><q id='pLHdm'></q></dir></style></legend>
                1. 本文介紹了使用 javascript 旋轉(zhuǎn) div的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  我想單擊一個(gè) div 并旋轉(zhuǎn)另一個(gè) div,然后當(dāng)再次單擊第一個(gè) div 時(shí),另一個(gè) div 會(huì)旋轉(zhuǎn)回原來(lái)的位置.

                  I want to click on one div and rotate another div then when the firsts div is clicked again the other div rotates back to its original position.

                  如果需要,我可以參考這個(gè)庫(kù)http://ricostacruz.com/jquery.transit.

                  I can reference this library if required http://ricostacruz.com/jquery.transit.

                  推薦答案

                  要旋轉(zhuǎn) DIV,我們可以添加一些 CSS,使用 CSS transform rotate 旋轉(zhuǎn) DIV.

                  To rotate a DIV we can add some CSS that, well, rotates the DIV using CSS transform rotate.

                  要切換旋轉(zhuǎn),我們可以保留一個(gè)標(biāo)志,一個(gè)帶有布爾值的簡(jiǎn)單變量,告訴我們旋轉(zhuǎn)的方式.

                  To toggle the rotation we can keep a flag, a simple variable with a boolean value that tells us what way to rotate.

                  var rotated = false;
                  
                  document.getElementById('button').onclick = function() {
                      var div = document.getElementById('div'),
                          deg = rotated ? 0 : 66;
                  
                      div.style.webkitTransform = 'rotate('+deg+'deg)'; 
                      div.style.mozTransform    = 'rotate('+deg+'deg)'; 
                      div.style.msTransform     = 'rotate('+deg+'deg)'; 
                      div.style.oTransform      = 'rotate('+deg+'deg)'; 
                      div.style.transform       = 'rotate('+deg+'deg)'; 
                  
                      rotated = !rotated;
                  }
                  

                  var rotated = false;
                  
                  document.getElementById('button').onclick = function() {
                      var div = document.getElementById('div'),
                          deg = rotated ? 0 : 66;
                  
                      div.style.webkitTransform = 'rotate('+deg+'deg)'; 
                      div.style.mozTransform    = 'rotate('+deg+'deg)'; 
                      div.style.msTransform     = 'rotate('+deg+'deg)'; 
                      div.style.oTransform      = 'rotate('+deg+'deg)'; 
                      div.style.transform       = 'rotate('+deg+'deg)'; 
                      
                      rotated = !rotated;
                  }

                  #div {
                      position:relative; 
                      height: 200px; 
                      width: 200px; 
                      margin: 30px;
                      background: red;
                  }

                  <button id="button">rotate</button>
                  <br /><br />
                  <div id="div"></div>

                  要為旋轉(zhuǎn)添加一些動(dòng)畫(huà),我們所要做的就是添加 CSS 過(guò)渡

                  To add some animation to the rotation all we have to do is add CSS transitions

                  div {
                      -webkit-transition: all 0.5s ease-in-out;
                      -moz-transition: all 0.5s ease-in-out;
                      -o-transition: all 0.5s ease-in-out;
                      transition: all 0.5s ease-in-out;
                  }
                  

                  var rotated = false;
                  
                  document.getElementById('button').onclick = function() {
                      var div = document.getElementById('div'),
                          deg = rotated ? 0 : 66;
                  
                      div.style.webkitTransform = 'rotate('+deg+'deg)'; 
                      div.style.mozTransform    = 'rotate('+deg+'deg)'; 
                      div.style.msTransform     = 'rotate('+deg+'deg)'; 
                      div.style.oTransform      = 'rotate('+deg+'deg)'; 
                      div.style.transform       = 'rotate('+deg+'deg)'; 
                      
                      rotated = !rotated;
                  }

                  #div {
                      position:relative; 
                      height: 200px; 
                      width: 200px; 
                      margin: 30px;
                      background: red;
                      -webkit-transition: all 0.5s ease-in-out;
                      -moz-transition: all 0.5s ease-in-out;
                      -o-transition: all 0.5s ease-in-out;
                      transition: all 0.5s ease-in-out;
                  }

                  <button id="button">rotate</button>
                  <br /><br />
                  <div id="div"></div>

                  另一種方法是使用類(lèi),并在樣式表中設(shè)置所有樣式,從而將它們排除在 javascript 之外

                  Another way to do it is using classes, and setting all the styles in a stylesheet, thus keeping them out of the javascript

                  document.getElementById('button').onclick = function() {
                      document.getElementById('div').classList.toggle('rotated');
                  }
                  

                  document.getElementById('button').onclick = function() {
                      document.getElementById('div').classList.toggle('rotated');
                  }

                  #div {
                      position:relative; 
                      height: 200px; 
                      width: 200px; 
                      margin: 30px;
                      background: red;
                      -webkit-transition: all 0.5s ease-in-out;
                      -moz-transition: all 0.5s ease-in-out;
                      -o-transition: all 0.5s ease-in-out;
                      transition: all 0.5s ease-in-out;
                  }
                  
                  #div.rotated {
                      -webkit-transform : rotate(66deg); 
                      -moz-transform : rotate(66deg); 
                      -ms-transform : rotate(66deg); 
                      -o-transform : rotate(66deg); 
                      transform : rotate(66deg); 
                  }

                  <button id="button">rotate</button>
                  <br /><br />
                  <div id="div"></div>

                  這篇關(guān)于使用 javascript 旋轉(zhuǎn) div的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調(diào)用 abort (jQuery) 之后,瀏覽器也會(huì)等待 ajax 調(diào)用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無(wú)法加載,請(qǐng)求的資源上不存在“Access-Control-Allow-Origin標(biāo)頭) - IT屋-程序員軟件開(kāi)發(fā)技術(shù)分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請(qǐng)求是否有可能不遵循重定向 (301 302))
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內(nèi)容)
                  Restrictions of XMLHttpRequest#39;s getResponseHeader()?(XMLHttpRequest 的 getResponseHeader() 的限制?)
                2. <tfoot id='c4bqg'></tfoot>
                    <bdo id='c4bqg'></bdo><ul id='c4bqg'></ul>
                    1. <legend id='c4bqg'><style id='c4bqg'><dir id='c4bqg'><q id='c4bqg'></q></dir></style></legend>
                      <i id='c4bqg'><tr id='c4bqg'><dt id='c4bqg'><q id='c4bqg'><span id='c4bqg'><b id='c4bqg'><form id='c4bqg'><ins id='c4bqg'></ins><ul id='c4bqg'></ul><sub id='c4bqg'></sub></form><legend id='c4bqg'></legend><bdo id='c4bqg'><pre id='c4bqg'><center id='c4bqg'></center></pre></bdo></b><th id='c4bqg'></th></span></q></dt></tr></i><div class="6ykw4ae" id='c4bqg'><tfoot id='c4bqg'></tfoot><dl id='c4bqg'><fieldset id='c4bqg'></fieldset></dl></div>

                              <tbody id='c4bqg'></tbody>
                          1. <small id='c4bqg'></small><noframes id='c4bqg'>

                            主站蜘蛛池模板: 深圳展厅设计_企业展馆设计_展厅设计公司_数字展厅设计_深圳百艺堂 | 【甲方装饰】合肥工装公司-合肥装修设计公司,专业从事安徽办公室、店面、售楼部、餐饮店、厂房装修设计服务 | 青岛空压机,青岛空压机维修/保养,青岛空压机销售/出租公司,青岛空压机厂家电话 | 暴风影音| 高速混合机_锂电混合机_VC高效混合机-无锡鑫海干燥粉体设备有限公司 | 盘式曝气器-微孔曝气器-管式曝气器-曝气盘-斜管填料 | 郑州市前程水处理有限公司 | 乐之康护 - 专业护工服务平台,提供医院陪护-居家照护-居家康复 | 淋巴细胞分离液_口腔医疗器材-精欣华医疗器械(无锡)有限公司 | 2025第九届世界无人机大会 | 集装箱箱号识别_自重载重图像识别_铁路车号自动识别_OCR图像识别 | 国资灵活用工平台_全国灵活用工平台前十名-灵活用工结算小帮手 | IPO咨询公司-IPO上市服务-细分市场研究-龙马咨询 | 塑料薄膜_PP薄膜_聚乙烯薄膜-常州市鑫美新材料包装厂 | 衡阳耐适防护科技有限公司——威仕盾焊接防护用品官网/焊工手套/焊接防护服/皮革防护手套 | 跨境物流_美国卡派_中大件运输_尾程派送_海外仓一件代发 - 广州环至美供应链平台 | 超声波焊接机_超音波熔接机_超声波塑焊机十大品牌_塑料超声波焊接设备厂家 | 全自动翻转振荡器-浸出式水平振荡器厂家-土壤干燥箱价格-常州普天仪器 | 扬尘监测_扬尘监测系统_带证扬尘监测设备 - 郑州港迪科技有限公司 | 优秀的临床医学知识库,临床知识库,医疗知识库,满足电子病历四级要求,免费试用 | 耐腐蚀泵,耐腐蚀真空泵,玻璃钢真空泵-淄博华舜耐腐蚀真空泵有限公司 | 微信聊天记录恢复_手机短信删除怎么恢复_通讯录恢复软件下载-快易数据恢复 | 仿古建筑设计-仿古建筑施工-仿古建筑公司-汉匠古建筑设计院 | 智能终端_RTU_dcm_北斗星空自动化科技 | 英思科GTD-3000EX(美国英思科气体检测仪MX4MX6)百科-北京嘉华众信科技有限公司 | 常州律师事务所_常州律所_常州律师-江苏乐天律师事务所 | 细砂提取机,隔膜板框泥浆污泥压滤机,螺旋洗砂机设备,轮式洗砂机械,机制砂,圆锥颚式反击式破碎机,振动筛,滚筒筛,喂料机- 上海重睿环保设备有限公司 | 广州企亚 - 数码直喷、白墨印花、源头厂家、透气无手感方案服务商! | cnc精密加工_数控机械加工_非标平键定制生产厂家_扬州沃佳机械有限公司 | 模具钢_高速钢_不锈钢-万利钢金属材料| 工业铝型材生产厂家_铝合金型材配件批发精加工定制厂商 - 上海岐易铝业 | 电磁铁_推拉电磁铁_机械手电磁吸盘电磁铁厂家-广州思德隆电子公司 | 双杰天平-国产双杰电子天平-美国双杰-常熟双杰仪器 | 专业生产动态配料系统_饲料配料系统_化肥配料系统等配料系统-郑州鑫晟重工机械有限公司 | 搪瓷搅拌器,搪玻璃搅拌器,搪玻璃冷凝器_厂家-淄博越宏化工设备 | 丝杆升降机-不锈钢丝杆升降机-非标定制丝杆升降机厂家-山东鑫光减速机有限公司 | 脑钠肽-白介素4|白介素8试剂盒-研域(上海)化学试剂有限公司 | 翅片管散热器价格_钢制暖气片报价_钢制板式散热器厂家「河北冀春暖气片有限公司」 | led冷热冲击试验箱_LED高低温冲击试验箱_老化试验箱-爱佩百科 | 粉末冶金注射成型厂家|MIM厂家|粉末冶金齿轮|MIM零件-深圳市新泰兴精密科技 | 低温等离子清洗机(双气路进口)-嘉润万丰 | 福建珂朗雅装饰材料有限公司「官方网站」|