Webéçºè ã®éã§ãCSSã¢ãã¡ãŒã·ã§ã³æ©èœïŒé·ç§»/ã¢ãã¡ãŒã·ã§ã³ïŒã®ãããã¯ããŸããŸãåãäžããããŠããŸããã»ãšãã©ãã¹ãŠã®ã¯ã©ã€ã¢ã³ãéçºäŒè°ã§ããã®æ°ããæè¡ã®çŽ æŽãããå©ç¹ã«ã€ããŠèãããšãã§ããŸãã
CSSã¢ãã¡ãŒã·ã§ã³ã®ããã©ãŒãã³ã¹ãšæè»æ§ã«ããããã°ãããããšãã§ããŸãããå®éã®å€§èŠæš¡ãããžã§ã¯ãã§ã¯äžå®å®ã§æªçãªããããããã®æ°æ©èœãæ¢ã«äœ¿çšã§ããŸããïŒ
ãã®æçš¿ã§ã¯ãä»æ¥ã¯ã©ã€ã¢ã³ãéçºã®æ°ãããã¯ãããžãŒã䜿çšããããšãéåžžã«éèŠã§ããçç±ãšãéäžã§ããªããåŸ ã£ãŠãããããããªãå°é£ã«ã€ããŠèª¬æããŸãã
ä»æ§ç¶æ³
W3Cã®CSSãã©ã³ãžã·ã§ã³ãšã¢ãã¡ãŒã·ã§ã³ã¢ãžã¥ãŒã«ã¯ãã¯ãŒãã³ã°ãã©ãããç¶æ ã®ãŸãŸã§ãããFirefoxãOperaãããã³Internet Explorer 10ã¯ãããã®ããããã£ã®ãã¬ãã£ãã¯ã¹ãæ¢ã«ç Žæ£ããŠããŸãã ãã¬ãã£ãã¯ã¹ãåé€ãããšããããšã¯ããã©ãŠã¶ã®ã¡ãŒã«ãŒãæ¢ã«æè¡ã®å®å®æ§ã«èªä¿¡ãæã£ãŠããããšãæå³ããç©æ¥µçã«äœ¿çšããããšããå§ãããŸãã
JavaScriptã®ããã©ãŒãã³ã¹ã®äœããåèã«ãã¢ãã¡ãŒã·ã§ã³ãéããŠãŠãŒã¶ãŒã®ãŠãŒã¶ãŒãšã¯ã¹ããªãšã³ã¹ãåäžãããããšã倧äŒæ¥ããŸã æããŠããå Žåã¯ãä»ããã€ã³ã¿ãŒãã§ã€ã¹éçºã¢ãããŒããåæ€èšããCSS3æ©èœã®äœ¿çšãéå§ãããšãã§ãã
æ å ±ãžã®é£¢ã
ãããã¯ãŒã¯äžã®ã©ã€ããããžã§ã¯ãã«CSSã¢ãã¡ãŒã·ã§ã³ãå°å ¥ããçµéšããªããããæ¥åžžã®ã¿ã¹ã¯ã®å®è£ ã«é¢ããæ å ±ã¯ã»ãšãã©ãããŸããã æ¥çã®å é§è ãšããŠè¡åããããšãæããŠã誰ãããŸã JavaScriptãœãªã¥ãŒã·ã§ã³ã䜿çšããŠããŸãã
巚倧ãªãµã€ãºã®DOMããªãŒãããŒãžäžã®ã¢ãã¡ãŒã·ã§ã³åããããããã¯ã®æ°ãé«åºŠãªãã¹ããçžäºã®ãããã¯ã®å€ãã®ã¬ã€ã€ãŒãªã©ãå€ãã®èŠå ã®è¡çªã«ããçããç¹å®ã®ãã°ã«çŽé¢ãããšãããã«èŠããå¿ èŠããããŸãã ãã®ãããªè² è·ã«å¯ŸåŠããããšãããšããã©ãŠã¶ã¯æé©åã¢ã«ãŽãªãºã ãæ倧éã«æŽ»çšããŸãããããã¯äžå¯è§£ãªãã°ã«ã€ãªããå ŽåããããŸãã
æè¿ãç§ãã¡ã¯ãã°ãã°ãããã¯ãŒã¯äžã®èšèããªããã©ãŠã¶ã®ãã°ã«ééããŸãã ãã®çµæãåé¡ãèªåã§èª¿æ»ãããã°ã¬ããŒããäœæãããããä¿®æ£ããããã®ç°åžžãªè§£æ±ºçãæ¢ãå¿ èŠããããŸãã
倧æäŒæ¥ãæ°ããã¯ã©ã€ã¢ã³ãéçºãã¯ãããžãŒã®äœ¿çšãéå§ããã®ãæ©ããã°æ©ãã»ã©ãWebéçºæ¥çã®éçºã¯éããªããŸãã
çŸå®äžçã®CSSã¢ãã¡ãŒã·ã§ã³
Webãããžã§ã¯ããæ°ãããã¯ãããžãŒã飌ããªããããšããŠãæ¥çã®å é§è ã«ãªãããšãæããªãã£ããã®ãèŠãŠã¿ãŸãããã
VKontakteã¯ãåçŽãªå°ããªãããã¯ã§ã¢ãã¡ãŒã·ã§ã³ãéšåçã«äœ¿çšããåçŽãªäžéæ床ã®ã¢ãã¡ãŒã·ã§ã³ãããã¹ãã®è²ã®å€åã§ããCSSã§ã¯ãªãJavaScriptã¢ãã¡ãŒã·ã§ã³ãéžæããããšããããããŸãã ãããžã§ã¯ãã¹ã¿ã€ã«ãæ€çŽ¢ãããšã17åã®é·ç§»ãšã³ããªãçæãããŸãïŒãã¬ãã£ãã¯ã¹ãæã€ããããã£ã¯ã«ãŠã³ããããŸããïŒã
Facebookã§ã¯ãã¢ãã¡ãŒã·ã§ã³ãå®çããããã¹ãŠã®ã¹ã¿ã€ã«ã§5ã€ã®ãã©ã³ãžã·ã§ã³ãšã³ããªããèŠã€ãããŸããã§ãããç§ã®ç®ãåŒããã¢ãã¡ãŒã·ã§ã³ã¯JSã®ã¿ã§ããã
Google+ã®ã¡ã³ããŒã¯ãåºæ¬çã«ã¢ãã¡ãŒã·ã§ã³ã䜿çšããŠããªãããã§ãïŒãããããã¢ãã¡ãŒã·ã§ã³ã®æäœã«é¢ããChromeã®åé¡ãåå ã§ãïŒã移è¡ãšã³ããªã¯3ã€ã ãã§ãã ãã¢ãã¡ãŒã·ã§ã³ããæ€çŽ¢ãããšãGoolge +ã§1ã€ã®åºçŸã®ã¿ãè¿ãããŸããã
Odnoklassnikiã®ã¹ã¿ã€ã«ã§èšäºãæžããŠããæç¹ã§ã140ã®ãã©ã³ãžã·ã§ã³ãš4ã€ã®ã¢ãã¡ãŒã·ã§ã³åŒã³åºãããããŸããã¢ãã¡ãŒã·ã§ã³ã®äžéšã¯æšæºåãããå€ãã®å Žæã§åå©çšãããŠããŸãã
èå³æ·±ãã¡ã¢-èšäºã®æåã®ããŒãžã§ã³ãäœæãããŠãã2ãæãçµéããŸãããããã®æéäžãOdnoklassnikiãé€ããäžèšã®ãããžã§ã¯ãã®ã¢ãã¡ãŒã·ã§ã³ã®æ°ã¯å¢ããŸããã§ãã-ãœãŒã·ã£ã«ãããã¯ãŒã¯ã®ã¢ãã¡ãŒã·ã§ã³ã®æ°ã¯ã»ãŒ3åã«å¢å ããŸããã
ã¢ãã¡ãŒã·ã§ã³åãã䟡å€ããããã®
ã€ã³ã¿ãŒãã§ã€ã¹ãçŸå®ã«è¿ã¥ããã°è¿ã¥ããã»ã©ããŠãŒã¶ãŒã«ãšã£ãŠããæ確ã«ãªããŸãã 人çã§ã¯ãå³åº§ã«ã»ãšãã©äœãèµ·ãããŸããããã¢ãéããããã©ããããããéããããããšããŠã§ãäžã§çºçãããããªéããééãã§ã¯ãªããå€æ°ã®äžéç¶æ ã芳å¯ãããŸãã
ãããŒãããããããŠã³ã¡ãã¥ãŒãæ å ±ããŒã«ãããã«é衚瀺ã®ã³ã³ãããŒã«ã衚瀺ãããæãäžè¬çãªã¢ã¯ã·ã§ã³ã«ãã¢ãã¡ãŒã·ã§ã³ãé©çšããããšããŸãã ã¢ãã¡ãŒã·ã§ã³ã¯ãããŸããŸãªç¹æ» ãšååçž®ã䜿çšããŠããŠãŒã¶ãŒã®æ³šæãã³ã³ãããŒã«ã«éäžãããã®ã«åœ¹ç«ã¡ãŸãã
ããç¶æ ããå¥ã®ç¶æ ãžã®ã³ã³ãããŒã«ãšé·ç§»ã®ã¹ã ãŒãºãªçžäºäœçšã¯ããŠãŒã¶ãŒãããŒãžã§äœãèµ·ãã£ãŠããããããããç解ããã®ã«åœ¹ç«ã¡ãŸãã ã¢ãã¡ãŒã·ã§ã³ããã¿ã³ãšã¹ã©ã€ããŒã ãã«å¶éããã®ã§ã¯ãªããæ³ååãåãããŠãã ãããCSSããããã£ãããã€ã䜿çšããã ãã§ãã€ã³ã¿ãŒãã§ã€ã¹ãããå¿«é©ã«ããããšãã§ããŸãã
çµéšã®äº€æ
ãã°ãšãœãªã¥ãŒã·ã§ã³ã®éžæ
CSS3ã¢ãã¡ãŒã·ã§ã³ãšãã°ã®èª¬æã䜿çšããä»ã®äººã®äŸã«åºããããšããç§ãã¡ã¯ãã°ãã°åé¡ããã®ç¹ç°æ§ã«åž°ããåé¡ã«æ³šæãæããŸããã ããããè¿ãå°æ¥äŒŒããããªããšãããã€ããããªãå Žåã§ããäœã«å¯ŸåŠããªããã°ãªããªãããäºåã«ç¥ã£ãŠããããšã¯æçšã§ãã
dabbletã®ãã¢ããŒãž ãäŸä»ãã¢ãŒã«ã€ã ïŒ J. Disk ïŒã
ãªãã©
äžéæ床ãšããã¯ã¹ã·ã£ããŠãªã©ã®ã¢ãã¡ãŒã·ã§ã³ãçµã¿åããããšãOperaã§åé¡ãçºçããå ŽåããããŸãïŒ ãã¢ããŒãžã®ãããã¯1ãåç § ïŒããããŒã§ã·ã£ããŠãå®å šã«æ¶ããå Žåãã¢ãã¡ãŒã·ã§ã³ãåŸæ¹ã«ããå Žåãã·ã£ããŠã¯é ããŠæ»ããäºæ³ãããæ»ãããã¯ãããŸããã
.no_sec { transition: opacity 1s, box-shadow 0; box-shadow: 0 0 5px 5px #000; } .no_sec:hover {opacity: 0; box-shadow: none;}
ãã°ãåé¿ããã«ã¯ãã·ã£ããŠãåå¥ã«ã¢ãã¡ãŒã·ã§ã³åããä»ã®é·ç§»é床å€ãéžæããå¿ èŠããããŸãã
.no_sec.shadow { transition: opacity 1s, box-shadow .3s; box-shadow: 0 0 5px 5px blue; } .no_sec.shadow:hover {opacity: 0; box-shadow: none;}
æ¬äŒŒèŠçŽ ãæã€ãããã¯ã¯ãOpera 12ã§åé¡ãªãã¢ãã¡ãŒã·ã§ã³åãããæåã®äŸïŒãããã¯2ïŒãšåæ§ã®ã¢ãŒãã£ãã¡ã¯ããæ®ããOpera 11.64ã§ã¯å®å®ããŠåäœããŸãã
.pseudo { position: relative; transition: opacity 1s; } .pseudo:hover {opacity: 0;} .pseudo::after { content: 'pseudo'; position: absolute; left: 0; top: 100%; height: 10px; width: 100%; background: blue; font-size: 10px; line-height: 1; }
æ¬äŒŒèŠçŽ ãç Žæ£ããéåžžã®ã¿ã°ã䜿çšããå¿ èŠããããŸãã
Firefox
é·ç§»ã§ãsãïŒç§ïŒã®å€ãæå®ããªãå ŽåãFirefoxã¯ã¢ãã¡ãŒã·ã§ã³ãå®å šã«ç¡èŠããŸãïŒãããã¯1ïŒã ãããã¯3ã§ã¯ãFirefoxã®ã·ã£ããŠã¢ãã¡ãŒã·ã§ã³ã®äœæ¥å€ãèšå®ãããŠããŸãã
ããã«ãFirefoxã¯ããã¥ã¡ã³ãã«åŸã£ãŠå³å¯ã«åäœããŸã ããã®ããã¥ã¡ã³ãã§ã¯ãæéã®äŸ¡å€ã¯æž¬å®ã®å°ºåºŠã«ãã£ãŠã®ã¿æ±ºå®ãããã¹ãã§ãããä»ã®ãã©ãŠã¶ãŒã¯éçºè ã«ãšã£ãŠãã銎æã¿ã®ããã¢ãããŒããéžæããŠããŸãã
Webkit
Macäžã®ChromeïŒå°ãªããšã第23ããŒãžã§ã³ãŸã§ïŒã§ãtransformãšå€æïŒãããã¯4ïŒã䜵çšããå Žåãããã³ä»ã®æ¡ä»¶äžã§ãããŒãžå šäœã®ããã¹ãã¹ã ãŒãžã³ã°ãäžæããŸãã
ã¹ã ãŒãžã³ã°ããïŒ
ã¹ã ãŒãžã³ã°ãªãïŒ
.scale { transition: transform 1s; /*-webkit-backface- visibility: hidden;*/ } .scale:hover {transform: scale(1.5)}
æ¬æãŸãã¯ã¡ãã€ãã®ããããã¹ãã®ãããã¯ã«é©çšãããbackface-visibility ïŒhiddenããããã£ã¯ãåé¡ã®è§£æ±ºã«åœ¹ç«ã¡ãŸããããã®ãããªä¿®æ£ã«ã¯çµæããããŸãïŒä»¥äžã®èšäºã®è©³çŽ°ãåç §ïŒãããã«ãããã¹ãã¯æ°žä¹ ã«ã¢ã³ããšã€ãªã¢ã¹ã倱ããŸãã
ãããã¯ãdisplayïŒblock-> displayïŒinline / inline-blockïŒãããã¯5ïŒã§ããããã£ãå€æŽãããšãChromeã§ç§»è¡ãæ©èœããŸããã
.inline b {opacity: 0; transition: opacity 1s; display: block; max-height: 0;} .inline:hover b {opacity: 1; display: inline; }
åé¡ãåé¿ããã«ã¯ãã¢ãã¡ãŒã·ã§ã³ã䜿çšããå¿ èŠããããŸãïŒãããã¯5.1ïŒã
@-webkit-keyframes reveal { from { opacity: 0; } to { opacity: 1; } } .inline.anim:hover b {-webkit-animation: reveal 1s;}
Windowsäžã®Chromeã§ã¯ãã¹ã ãŒãºãªå€æã¢ãã¡ãŒã·ã§ã³äžã«ããã¹ãŠã®å ¥åãçœãèæ¯ã«ãªããŸãïŒå€æã®ãããããã¯4ãšå ¥åã®ãããããã¯6ïŒã
backface-visibilityãããŒãžèŠçŽ ã«é©çšãããŠããå Žåããåæ§ã®å¹æã芳å¯ãããŸãã 解決çã¯ãŸã èŠã€ãããŸããã
äžè¬çãªãã°
Webkitãããã¯ã°ã©ãŠã³ãã€ã¡ãŒãžã®äœæ¥ã«ç§»è¡ãã以å€ã«ãé 延ãèšå®ããããšããã§ãããç»åãå³åº§ã«å€æŽãããŸãïŒãããã¯7ïŒã
.bg_img { background: red url(image1.png); transition: background-color 1s linear, background-image 0s linear 1s; } .bg_img:hover {background: blue url(image2.png);}
ãã®åé¡ã解決ããã«ã¯ãäžéæ床ã䜿çšããŠè€æ°ã®ã¬ã€ã€ãŒã§ã¢ãã¡ãŒã·ã§ã³ãçµã¿åãããå¿ èŠããããŸããã
移è¡äžãäžéæ床ã¢ãã¡ãŒã·ã§ã³ãå«ããããã¯ã¯ä»ã®ãããã¯ãšéãªããŸãã
åé¡ãåé¿ããã«ã¯ãäžã«ã¢ãã¡ãŒã·ã§ã³ãå¿ èŠãšããªããããã¯ã家ã«çœ®ããïŒèªåçã«é«ãz-indexãååŸããŸãïŒããŸãã¯æåã§z-indexãç»é²ããŸãïŒãããã¯8.1ïŒã
ãã°ã®äŸã§ããŒãžãæŽæ°ãããšãæåã®ããŒãžã§ã³ã®æ°ãæåŸããã®æéäžã«ç¶æ³ããŸã£ããå€åããããã©ãŠã¶ãŒã®æŽæ°ã®ããã€ãã®ããŒãžã§ã³ã§ãããã®ãã°ããŸã ä¿®æ£ãããŠããªãããšãæããã«ãªããŸããã
ã泚æ
CSSãã©ã³ãžã·ã§ã³ã§ã¯ãã¢ãã¡ãŒã·ã§ã³ã®é床ãå€æŽãããªã©ãåæ¹åã®ã¢ãã¡ãŒã·ã§ã³ãå¶åŸ¡ã§ããŸãã
.block {transition: 10s opacity;} .block:hover {opacity: 0; transition-duration: 1s;}
ãããŒãžã®ç§»è¡æã®äžéæ床ïŒ0; 1ç§ã§çºçããäžéæ床ãžã®éã®é·ç§»ïŒ1; 10ç§éç¶ããŸãã ãããã£ãŠãããšãã°ããæ°žä¹ ã«ããããªã³ã°ããå Žåãéåžžã«å€§ããªé 延ã䜿çšããŠãããŒç¶æ ã®ããããã£ãæ®ãããšãã§ããŸãã
ã¢ãã¡ãŒã·ã§ã³ã䜿çšããå Žåãã¢ãã¡ãŒã·ã§ã³äžã«ãããã¯ãå€éšã®åœ±é¿ãåããªãããšãæåŸ ããå¿ èŠããããŸãïŒãããŒãžã®è²ã®å€æŽïŒã ãããè¡ãã«ã¯ãæåã«ãanimation-play-stateïŒpaused;ãã䜿çšããŠã¢ãã¡ãŒã·ã§ã³ãåæ¢ãããããanimationïŒnone;ãããããã£ã䜿çšããŠã¢ãã¡ãŒã·ã§ã³ãå®å šã«ãŒãã«ããŸãã
ã¢ãã¡ãŒã·ã§ã³ãæäœããå Žåãå®æçã«åç¹ã«æ»ã£ãŠãæãå€ãCSSæ©èœãå調æ»ããå¿ èŠããããŸããããã¯ãç䌌ã¯ã©ã¹activeã§å€æããããã§ãã
èé¢å¯èŠæ§
åã«ãwebkitãã©ãŠã¶ãŒã®ããã€ãã®ãã°ã®è§£æ±ºçãšããŠbackface -visibilityã«ã€ããŠèšåããŸãããããã®ããããã£ã¯ããã«å€§ããªåé¡ã«ã€ãªããå¯èœæ§ããããŸãã ãã®ããããã£ã®æšæºçãªç®çïŒ3Dã¢ãã¡ãŒã·ã§ã³ãããã¯ã®è£åŽãé ãïŒã«å ããŠãããŒããŠã§ã¢ã¢ã¯ã»ã©ã¬ãŒã·ã§ã³ãæå¹ã«ããããã«ãã䜿çšãããŸããããã«ãããGPUã䜿çšããŠãã©ãŠã¶ãŒã®ããŒãžã®ã¬ã³ããªã³ã°æéãççž®ã§ããŸãã
ãã®ããããã£ãå°ãªããšã1ã€ã®ããŒãžèŠçŽ ã«é©çšãããšãããšãã°ããã¹ãŠã®å ¥åïŒã¢ãã¡ãŒã·ã§ã³ãã°ã®éžæã®7çªç®ã®é ç®ïŒã®äžã«çœãèæ¯ã衚瀺ãããããããã¹ãã¹ã ãŒãžã³ã°ã¢ãŒããå€æŽããããããŸãã
ããŒãžã®äžéšãæ¢ã«æç»ãããåŸã«ãã®ããããã£ãåçã«é©çšããããšã«ãããå¹³åããŒãžã¬ã³ããªã³ã°æéãå€§å¹ ã«å¢å ããããšãæè¿çºèŠãããŸããã ã»ãšãã©ã®å Žåãããã¯ããŒãžå šäœãåæç»ãããGPUã¢ã¯ã»ã©ã¬ãŒã·ã§ã³ã¢ãŒããžã®ç§»è¡ã«ãããã®ã§ãã
ã¢ãã¡ãŒã·ã§ã³äžã®ããã¹ãã®ã¡ãã€ããé¿ããããã«ãMacäžã®ChromeãšSafariã®bodyèŠçŽ ã«é©çšããããšã«ãããšãããã®ããããã£ã®çµæã«åããŠééããŸããã åæã«ãå€ãã®äžå¯è§£ãªãã°ãSafari 5ã«çŸãå§ããŸããããã®çµæãããŒãžã¯å®å šã«äºæž¬äžå¯èœãªå Žæã«ç§»åããŸããã Safari 6ã®ãªãªãŒã¹ã«ãããç¶æ³ã¯å°ãèœã¡çããäžéãªããããã£ã«é¢ãããã©ãŠã¶ã®åäœã¯çŸåšã®Chromeã®åäœãšåçã«ãªããŸããã
ãªã³ãµã€ã
次ã®ãã©ãŠã¶ã®æŽæ°ã«ãããã°ã®ãã¬ãã·ã£ãŒã®äžã§ããŒã¿ã«ãé¥ããããªãå Žåã¯ããã©ãŠã¶ã®æŽæ°ã«åžžã«æ³šæãæããéçºè åãããŒãžã§ã³ãšãã¬ãã¥ãŒããŒãžã§ã³ã確èªããŠãã ããã
æ°ããæè¡ãšæãããã¿ãã¬ãã£ãã¯ã¹ã®ãµããŒããå®è£ ããããšã«å ããŠãå®å šã«å®å®ããããŒãžã¬ã³ããªã³ã°æé©åã¢ã«ãŽãªãºã ãæ°ããããŒãžã§ã³ã«ä»å±ããããšã¯ãããŸããã ãã©ãŠã¶ãGPUã®ã¬ã³ããªã³ã°ã®äžéšãã¹ããŒãå§ããŠããããšãèãããšããã°ã¯ç¹å®ã®ããŒããŠã§ã¢ãæèŒãããã·ã³ã§ã®ã¿åçã§ãããšæåŸ ããããšãã§ããŸãã åããã©ãŠã¶ã®äžéšã®ã³ã³ãã¥ãŒã¿ãŒã§ã¯ããããªã«ãŒããåå ã§3Då€æãæ©èœããªãå ŽåããããŸããã
å®å®ãããã©ã³ãã§ã®Chromeã®21çªç®ã®ããŒãžã§ã³ã®ãªãªãŒã¹ã«äŒŽããCSS3ã¢ãã¡ãŒã·ã§ã³ã«é¢é£ããäžå¯è§£ãªãã°ã®å€ãã«å¯ŸåŠããå¿ èŠããããŸãããé倧ãªãã°ã®1ã€ã¯ãé»ãæç¹ïŒWindowsäžã®Chromeã®ã¿ïŒã®ãã°ã§ãããäžéæ床ã¢ãã¡ãŒã·ã§ã³ã æãèå³æ·±ãã®ã¯ããã°ã22çªç®ã®éçºããŒãžã§ã³ã§ä¿®æ£ãããå Žåã§ããå®å®ããŒãžã§ã³ãšéçºããŒãžã§ã³ïŒChromeã§ïŒãç°¡åã«ç°ãªãå¯èœæ§ãããããšã§ãã
Safari 6ã®ãªãªãŒã¹ã§èå³æ·±ãã±ãŒã¹ã確èªãããŸãããæŽæ°ã«ããããã©ãŠã¶ãŒã¯Webkitãšã³ãžã³ã®éçºãã©ã³ãããå€ãã®å€æŽãåŒãåºããçŸåšã®Chromeã®å€ãã®ãã°ãæ¡çšããŸããã
æé©å
ã€ã³ã¿ãŒãã§ãŒã¹éçºããŒã ã®äž»ãªã«ãŒã«ã®1ã€ã¯ãã§ããã ãå€ãã®çŽç²ãªCSSãœãªã¥ãŒã·ã§ã³ã§ãã JavaScriptã®ä»£ããã«CSSã䜿çšãããšãã€ã³ã¿ãŒãã§ã€ã¹ã®é床ãšéçºæéã®äž¡æ¹ã®é¢ã§ãã¯ã©ã€ã¢ã³ãããŒãã®ããã©ãŒãã³ã¹ãå€§å¹ ã«åäžããŸãã
ãã¹ãŠã®ãã€ãæ°
åããããã£ãåå¥ã«ãªã¹ããã代ããã«ãçãç¥èšæ³ã䜿çšããŸãã
transition-property: top; transition-duration: 1s; transition-timing-function: ease; transition-delay: 0.5s;
= transition: top 1s .5s;
ã¡ãªã¿ã«ãæå°éã®ã¢ãã¡ãŒã·ã§ã³ã¬ã³ãŒãã¯ãtransitionïŒ1sãã§ãæ®ãã®ããã©ã«ãããããã£ã¯ãall ease 0;ãã§ãã
éçºè ã¯ãç¹å®ã®ã¢ãã¡ãŒã·ã§ã³åãããããããã£ãå®çŸ©ãã代ããã«ãéåççãªã¢ãã¡ãŒã·ã§ã³ã®äœ¿çšäŸãããç®ã«ããŸãã
transition: all ⊠;
æ確ã§ã¯ãªã
transition: opacity ⊠;
ããããããã¯æ°æåãä¿åããã®ã«åœ¹ç«ã¡ãŸãããæçµçã«ã¯ãã¢ãã¡ãŒã·ã§ã³åããããããã¯ã®ããã€ãã®ãã©ã¡ãŒã¿ãŒãå€æŽãããšãã«ãäžå¿ èŠãªèšç®ã§äœåºŠããã©ãŠã¶ãŒãããŒãããŸãã
ãŸããæ¥é èŸã«åŸãããšãå¿ããªãã§ãã ãããããšãã°ã-ms-animationããããã£ãš-ms-transitionããããã£ã¯ãŸã£ããååšããŸããã Internet Explorerã®10çªç®ã®ããŒãžã§ã³ã«ã¯ããã¬ãã£ãã¯ã¹ãæ¢ã«çç¥ãããŠããŸãã CSS ããªããã»ããµã䜿çšãããšãããã¯ã¹ã€ã³ã䜿çšããŠãã¬ãã£ãã¯ã¹ãç°¡åã«æäœã§ããŸãã
æšæºå
ãªããžã§ã¯ãæåã®CSSã¢ãããŒãã«ãããå埩çãªããããã£ãå€§å¹ ã«ç¯çŽã§ããŸãã ã¹ã¿ã€ã«ç®¡çã·ã¹ãã ã§ã¯ãã¢ãã¡ãŒã·ã§ã³ã®æšæºåã«ãé¢ä¿ããOOCSSã¢ãããŒããç©æ¥µçã«äœ¿çšããŠããŸãã
åå©çšãããã¢ãžã¥ãŒã«ã®1ã€ã®äŸã次ã«ç€ºããŸãã
.fade { transition: .3s opacity, visibility 0s .3s; visibility:hidden; opacity: 0; } .fade_in:hover .fade { transition-delay: 0s; visibility: visible; opacity: 1; }
ãã®æšæºã¢ãžã¥ãŒã«ã䜿çšãããšãæãäžè¬çãªã¢ãã¡ãŒã·ã§ã³å¹æã®ããã«ç¹°ãè¿ãçºçããã³ãŒãã®æãä¿åã§ããŸãã ããã«ããå¯èŠæ§ãããããã£ã䜿çšããŠãCSSã¢ãã¡ãŒã·ã§ã³ããµããŒãããªããã©ãŠã¶ãŒã®äžäœäºææ§ãå®è£ ããŸãã
ãããã«
CSSã¢ãã¡ãŒã·ã§ã³ãæ±ãéã«å¯ŸåŠããªããã°ãªããªãå€ãã®å°é£ãèŠããšãåªåã¯æ£åœåãããŠããªãããã«èŠãããããããŸããããããã¯å®å šã«ããã§ã¯ãããŸããã
æåã«ããŠãŒã¶ãŒã€ã³ã¿ãŒãã§ã€ã¹ã®æäœãæ¹åãã匷åãªããŒã«ãçºèŠããŸãããããã¯ã察å¿ããJavaScriptãšæ¯èŒããŠã¯ã©ã€ã¢ã³ãã®ããã©ãŒãã³ã¹ã«å€§ããªåœ±é¿ãäžããŸããã ãã®ãã¯ãããžãŒã®ãã€ãã£ãæ§ã«ããããã©ãŠã¶ãŒã¯GPUã®èšç®èœåã䜿çšããŠããã¬ã³ããªã³ã°èŠçŽ ã®é床ãæé©åã§ããŸãã
第äºã«ãCSSã¢ãã¡ãŒã·ã§ã³ã®æè»æ§ãæ¢åããã³æ°èŠã®ã€ã³ã¿ãŒãã§ãŒã¹ã«ãã¯ãããžãŒãå°å ¥ããã¹ããŒããšã·ã³ãã«ãã«éåžžã«æºè¶³ããŠããŸãã å ±éã®ã¢ãããŒããéçºããäžåºŠãã¯ãããžãŒã®æ©èœãæŽçããã®ã§ãå€ãã®å éšãããžã§ã¯ãã«ç°¡åã«é©çšã§ããŸãã
第äžã«ãCSSã¢ãã¡ãŒã·ã§ã³ã§ã®äœæ¥ã¯èå³æ·±ãã§ãïŒ ãã¯ãããžãŒã®å é§è ã§ããéãåãéãããšãããããã£ãšã€ã³ã¹ãã¬ãŒã·ã§ã³ãäžãããã®ã¯äœã§ããããïŒ æ°ããã€ã³ã¿ãŒãã§ã€ã¹ãäœæããã¿ã¹ã¯ã«ã¢ãã¡ãŒã·ã§ã³èŠçŽ ãå°ãªããšã1ã€ããå Žåããã®èŠçŽ ãæäœããã®ã¯ã¯ããã«ãšããµã€ãã£ã³ã°ã«ãªããŸãã 称è³ã«å€ããã³ã¡ã³ããèããŠããã¹ããã©ã¯ãã£ã¹ãåœã®ã³ãŒããŒãšå ±æããããšã¯ç¹ã«çŽ æŽãããããšã§ãã