diff options
Diffstat (limited to 'files/it/web/api/window/matchmedia/index.html')
-rw-r--r-- | files/it/web/api/window/matchmedia/index.html | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/files/it/web/api/window/matchmedia/index.html b/files/it/web/api/window/matchmedia/index.html new file mode 100644 index 0000000000..a4dc984d9a --- /dev/null +++ b/files/it/web/api/window/matchmedia/index.html @@ -0,0 +1,91 @@ +--- +title: Window.matchMedia() +slug: Web/API/Window/matchMedia +translation_of: Web/API/Window/matchMedia +--- +<h2 id="Summary" name="Summary">Sommario</h2> + +<p>Restituisce un nuovo oggetto {{domxref("MediaQueryList")}} che rappresenta i risultati dell'anaisi effettuta in base alla stringa <a href="/en-US/docs/CSS/Media_queries" title="CSS/Media queries">media query</a> specificata.</p> + +<h2 id="Syntax" name="Syntax">Sintassi</h2> + +<pre class="syntaxbox"><em>mql</em> = window.matchMedia(<em>mediaQueryString</em>)</pre> + +<p><code>dove QueryString</code> è una stringa che rappresenta la ricerca media query per la quale restituire il nuovo oggetto {{domxref("MediaQueryList")}} .</p> + +<h2 id="Example" name="Example">Esempio</h2> + +<pre class="brush: js">if (window.matchMedia("(min-width: 400px)").matches) { + /* the viewport is at least 400 pixels wide */ +} else { + /* the viewport is less than 400 pixels wide */ +}</pre> + +<p>Questo codice permette di gestire la pagina in modo diverso quando la finestra è molto piccola.</p> + +<p>Vedere <a href="/en-US/docs/DOM/Using_media_queries_from_code" title="CSS/Using media queries from code">Using media queries from code</a> per altri esempi.</p> + +<h2 id="Browser_compatibility" name="Browser_compatibility">Compatibilità browser</h2> + +<p>{{CompatibilityTable()}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>9</td> + <td>{{CompatGeckoDesktop("6.0")}}</td> + <td>10</td> + <td>12.1</td> + <td>5.1</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>3.0</td> + <td>{{CompatGeckoMobile("6.0")}}</td> + <td>{{CompatNo}}</td> + <td>12.1</td> + <td>5</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="Specification" name="Specification">Specifica</h2> + +<ul> + <li><a class="external" href="http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface">The CSSOM View Module: The MediaQueryList Interface</a></li> +</ul> + +<h2 id="See_also" name="See_also">Vedere anche</h2> + +<ul> + <li><a href="/en-US/docs/CSS/Media_queries" title="CSS/Media queries">Media queries</a></li> + <li><a href="/en-US/docs/DOM/Using_media_queries_from_code" title="CSS/Using media queries from code">Using media queries from code</a></li> + <li>{{domxref("MediaQueryList")}}</li> + <li>{{domxref("MediaQueryListListener")}}</li> +</ul> |