久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <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="qwawimqqmiuu" 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 旋轉 div

        Rotate a div using javascript(使用 javascript 旋轉 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="qwawimqqmiuu" 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 旋轉 div的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我想單擊一個 div 并旋轉另一個 div,然后當再次單擊第一個 div 時,另一個 div 會旋轉回原來的位置.

                  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.

                  如果需要,我可以參考這個庫http://ricostacruz.com/jquery.transit.

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

                  推薦答案

                  要旋轉 DIV,我們可以添加一些 CSS,使用 CSS transform rotate 旋轉 DIV.

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

                  要切換旋轉,我們可以保留一個標志,一個帶有布爾值的簡單變量,告訴我們旋轉的方式.

                  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>

                  要為旋轉添加一些動畫,我們所要做的就是添加 CSS 過渡

                  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>

                  另一種方法是使用類,并在樣式表中設置所有樣式,從而將它們排除在 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>

                  這篇關于使用 javascript 旋轉 div的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  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 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                  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="qwawimqqmiuu" 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'>

                            主站蜘蛛池模板: 无码国模国产在线观看 | 三级在线免费观看 | 日日碰狠狠躁久久躁96avv | 国产视频第一页 | 欧美电影一区 | 做a网站 | 伊伊综合网 | 午夜久久久| 国产精品精品久久久 | 91精品国产91久久久久久密臀 | 国产精品污www一区二区三区 | 亚洲最大的黄色网址 | 免费h在线 | 欧美在线a| 欧美精品一区二区三区在线 | 欧美激情国产精品 | 欧美国产一区二区 | 91看片免费版 | 免费艹逼视频 | 激情综合五月 | 成人中文字幕在线 | 免费成人高清在线视频 | 日韩区 | 精品亚洲91 | 色婷婷国产精品 | 美女三区| 91一区二区三区 | 91精品国产麻豆 | 久久久高清 | 久久这里有精品 | 视频在线一区二区 | 亚洲精品小视频在线观看 | 视频一二三区 | 欧美日韩电影一区二区 | 精品视频一区二区三区在线观看 | 在线观看中文字幕 | 米奇狠狠鲁 | 午夜精品久久久久久不卡欧美一级 | 91精品国产乱码麻豆白嫩 | 国产一区黄色 | 欧美日韩一本 |