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

  • <legend id='aucbw'><style id='aucbw'><dir id='aucbw'><q id='aucbw'></q></dir></style></legend>

      • <bdo id='aucbw'></bdo><ul id='aucbw'></ul>
    1. <tfoot id='aucbw'></tfoot>

        <small id='aucbw'></small><noframes id='aucbw'>

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

        CSS 在容器內旋轉元素

        CSS rotate element while staying inside container(CSS 在容器內旋轉元素)

        <small id='1Hsza'></small><noframes id='1Hsza'>

              <bdo id='1Hsza'></bdo><ul id='1Hsza'></ul>
            • <i id='1Hsza'><tr id='1Hsza'><dt id='1Hsza'><q id='1Hsza'><span id='1Hsza'><b id='1Hsza'><form id='1Hsza'><ins id='1Hsza'></ins><ul id='1Hsza'></ul><sub id='1Hsza'></sub></form><legend id='1Hsza'></legend><bdo id='1Hsza'><pre id='1Hsza'><center id='1Hsza'></center></pre></bdo></b><th id='1Hsza'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='1Hsza'><tfoot id='1Hsza'></tfoot><dl id='1Hsza'><fieldset id='1Hsza'></fieldset></dl></div>

                <tfoot id='1Hsza'></tfoot>
              • <legend id='1Hsza'><style id='1Hsza'><dir id='1Hsza'><q id='1Hsza'></q></dir></style></legend>
                    <tbody id='1Hsza'></tbody>
                  本文介紹了CSS 在容器內旋轉元素的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  如果你看看:http://jsfiddle.net/KA4dz/

                  在這個演示中,您可以清楚地看到內部元素由于其旋轉而延伸到外部元素之外.請求是縮小內部元素(同時保持縱橫比和中心位置),使其適合其容器.

                  In this demo, you can clearly see the inner element reaching outside of the outer element due to its rotation. The request is to scale down the inner element (while maintaining aspect ratio's and center positioning) just so it fits within its container.

                  用例是用戶可以手動旋轉這樣的內部元素,同時確保它留在外部元素內.(所以簡單地縮小直到適合眼睛不是解決方案).

                  The use-case is that the user can manually rotate such an inner element while ensuring that it stays within the outer element. (so simply scaling down until it fits for the eyes is not a solution).

                  這是我的數學技能明顯缺乏的情況.在這個階段發布我嘗試過的內容不會有多大好處.有人能指出我正確的方向嗎?

                  This is a scenario where my math skills are clearly lacking. Posting what I've tried wont do much good at this stage. Can someone point me in the right direction?

                  謝謝!

                  另一個要求是內部元素僅在需要時縮小,而在不需要時從不縮小(需要時意味著離開外部元素的邊界)

                  One additional requirement is that the inner element only scales down whenever its required but never scales down when its not required (where required means leaving the boundaries of the outer element)

                  保存點擊:

                  .outer{
                      border: 1px solid black;
                      width: 100px;
                      height: 50px;
                      margin: 100px;
                  }
                  
                  .inner{
                      background: blue;
                      width: 100px;
                      height: 50px;
                  
                      transform: rotate(-40deg);
                      -webkit-transform: rotate(-40deg);
                  }
                  
                  <div class="outer">
                      <div class="inner">
                      </div>
                  </div>        
                  

                  推薦答案

                  這很有趣.這是我的解決方案:http://jsfiddle.net/fletiv/jrHTe/

                  This was interesting. Here's my solution: http://jsfiddle.net/fletiv/jrHTe/

                  而 javascript 看起來像這樣:

                  And javascript looks like this:

                  (function () {
                  
                  var setRotator = (function () {
                  
                      var setRotation,
                          setScale,
                          offsetAngle,
                          originalHeight,
                          originalFactor;
                  
                      setRotation = function (degrees, scale, element) {
                          element.style.webkitTransform = 'rotate(' + degrees + 'deg) scale(' + scale + ')';
                          element.style.transform = 'rotate(' + degrees + 'deg) scale(' + scale + ')';
                      };
                  
                      getScale = function (degrees) {
                  
                          var radians = degrees * Math.PI / 180,
                              sum;
                  
                          if (degrees < 90) {
                              sum = radians - offsetAngle;
                          } else if (degrees < 180) {
                              sum = radians + offsetAngle;
                          } else if (degrees < 270) {
                              sum = radians - offsetAngle;
                          } else {
                              sum = radians + offsetAngle;
                          }
                  
                          return (originalHeight / Math.cos(sum)) / originalFactor;
                      };
                  
                      return function (inner) {
                  
                          offsetAngle = Math.atan(inner.offsetWidth / inner.offsetHeight);
                          originalHeight = inner.offsetHeight;
                          originalFactor = Math.sqrt(Math.pow(inner.offsetHeight, 2) + Math.pow(inner.offsetWidth, 2));
                  
                          return {
                  
                              rotate: function (degrees) {
                                  setRotation (degrees, getScale(degrees), inner);
                              }
                          }
                      };
                  
                  }());
                  
                  var outer = document.getElementById('outer'),
                      inner = document.getElementById('inner'),
                      rotator = setRotator(inner),
                      degrees = 0;
                  
                  window.setInterval(function () {
                      degrees += 1;
                  
                      if (degrees >= 360) {
                          degrees = 0;
                      }
                  
                      rotator.rotate(degrees);
                  }, 50);
                  
                  }());
                  

                  這是一張試圖解釋我的代碼邏輯的圖像.:)

                  Here's an image which tries to explain the logic of my code. :)

                  這篇關于CSS 在容器內旋轉元素的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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() 的限制?)

                1. <tfoot id='bWUWq'></tfoot>
                  <legend id='bWUWq'><style id='bWUWq'><dir id='bWUWq'><q id='bWUWq'></q></dir></style></legend>

                    <tbody id='bWUWq'></tbody>
                      <i id='bWUWq'><tr id='bWUWq'><dt id='bWUWq'><q id='bWUWq'><span id='bWUWq'><b id='bWUWq'><form id='bWUWq'><ins id='bWUWq'></ins><ul id='bWUWq'></ul><sub id='bWUWq'></sub></form><legend id='bWUWq'></legend><bdo id='bWUWq'><pre id='bWUWq'><center id='bWUWq'></center></pre></bdo></b><th id='bWUWq'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='bWUWq'><tfoot id='bWUWq'></tfoot><dl id='bWUWq'><fieldset id='bWUWq'></fieldset></dl></div>
                        • <bdo id='bWUWq'></bdo><ul id='bWUWq'></ul>

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

                          2. 主站蜘蛛池模板: 人人天天操 | 日韩在线精品强乱中文字幕 | 在线观看国产视频 | 久久国产精品免费 | 美女视频黄的免费 | 国产福利观看 | 9999精品视频 | 午夜免费精品视频 | 国产免费一区二区三区网站免费 | 中文字幕在线视频观看 | 日韩在线视频播放 | 精品久久久久久亚洲综合网 | 精品久久久久久久久久久久久久 | 欧美a级网站| 久久精品亚洲欧美日韩精品中文字幕 | 91极品视频 | 不卡一二三区 | 欧美一级片久久 | 一区二区三区视频在线免费观看 | 久久久av | 日韩视频在线一区二区 | 欧洲一区在线观看 | 日本三级在线 | 精品国产乱码久久久久久a丨 | 91视频正在播放 | 亚洲成人av | 日韩精品久久久久 | 亚洲午夜精品一区二区三区他趣 | 欧美日韩视频在线播放 | 中文字幕视频在线 | 国产91丝袜在线播放 | 国产婷婷在线视频 | 成人三级在线观看 | 精品一区国产 | 伊人导航| 日韩免费一区 | 在线日韩av电影 | 一区二区在线免费播放 | a国产一区二区免费入口 | 亚洲永久在线 | 九九精品视频在线 |