国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

jquery - css3圖片抖動

瀏覽:195日期:2023-07-16 16:26:25

問題描述

我這個點擊document彈出圖片他會抖動,不知道是怎么回事?要是把外層的sdf去了他又是正常的,要怎么改

<!DOCTYPE html><html lang='en'><head> <meta charset='UTF-8'> <title>Document</title> <style>.sdf{ width:500px; height:500px; overflow:hidden; margin:200px auto; position:relative;} .outter{ width:174px; height:155px; position:absolute; top:100px; left:200px; transition:all 1s ease; } .dd{ background:url(http://www.ppt123.net/beijing/UploadFiles_8374/201203/2012032518062306.jpg); overflow:hidden; background-size:174px 155px; background-position:center center; transition:all 1s ease; width:0px; height:155px; margin:0 auto; } </style></head><body> <p class='sdf'><img src='http://img06.sephome.com/201602/D2D5B00588B8488496F37014622724F9.jpeg' src='http://img06.sephome.com/201602/D2D5B00588B8488496F37014622724F9.jpeg' alt='' style='display: inline;'><p class='outter'> <p class=’dd’></p></p> </p> <script src='http://cdn.bootcss.com/jquery/2.2.1/jquery.js'></script> <script>$(function() { $(document).on(’click’, function() { $('.dd').css({ ’width’:’174px’ }) }); }); </script></body></html>

問題解答

回答1:

[doge]這根本沒有涉及 css3 好不,你就是單純的改變一個p的寬度,p的寬度原來占據的位置是0,你通過js來改變它的寬度,就會觸發瀏覽器的重繪。

建議是使用 transform:scale(0); 縮放元素,點擊之后在還原 transform:scale(1);,這樣就不會觸發瀏覽器的重繪了。

回答2:

受1樓啟發

<!DOCTYPE html><html lang='en'><head> <meta charset='UTF-8'> <title>Document</title> <style>.sdf{ width:500px; height:500px; overflow:hidden; margin:200px auto; position:relative;} .outter{ width:174px; height:155px; position:absolute; top:100px; left:200px; transition:all 1s ease; } .dd{ background:url(http://www.ppt123.net/beijing/UploadFiles_8374/201203/2012032518062306.jpg); overflow:hidden; background-size:174px 155px; background-position:center center; transition:all 1s ease; transform: scale(0,1); width:174px; height:155px; margin:0 auto; } </style></head><body> <p class='sdf'><img src='http://img06.sephome.com/201602/D2D5B00588B8488496F37014622724F9.jpeg' src='http://img06.sephome.com/201602/D2D5B00588B8488496F37014622724F9.jpeg' alt='' style='display: inline;'><p class='outter'> <p class=’dd’></p></p> </p> <script src='http://cdn.bootcss.com/jquery/2.2.1/jquery.js'></script> <script>$(function() { $(document).on(’click’, function() { $('.dd').css(’transform’, ’scale(1, 1)’); }); }); </script></body></html>回答3:

你把width縮小就是縮小一下,跟抖動并沒有什么關系啊。。說起來我理解的抖動不應該是做一個animation,先向左transport再向右?

標簽: CSS
相關文章:
主站蜘蛛池模板: 鹿邑县| 武威市| 常宁市| 肇州县| 扬州市| 巩义市| 博客| 隆子县| 高州市| 盐亭县| 永仁县| 枝江市| 玉门市| 叶城县| 斗六市| 大姚县| 荔波县| 巢湖市| 西畴县| 宜都市| 黄大仙区| 丰原市| 邢台市| 高阳县| 渝中区| 左权县| 霍州市| 平利县| 梓潼县| 馆陶县| 江北区| 灌阳县| 永福县| 岗巴县| 长顺县| 黑山县| 静安区| 奈曼旗| 怀化市| 周宁县| 河间市|