From 1109132f09d75da9a28b649c7677bb6ce07c40c0 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:41:45 -0500 Subject: initial commit --- .../html/atributos_globales/contextmenu/index.html | 139 +++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 files/es/web/html/atributos_globales/contextmenu/index.html (limited to 'files/es/web/html/atributos_globales/contextmenu') diff --git a/files/es/web/html/atributos_globales/contextmenu/index.html b/files/es/web/html/atributos_globales/contextmenu/index.html new file mode 100644 index 0000000000..9cc32f7ace --- /dev/null +++ b/files/es/web/html/atributos_globales/contextmenu/index.html @@ -0,0 +1,139 @@ +--- +title: contextmenu +slug: Web/HTML/Atributos_Globales/contextmenu +tags: + - Atributos globales + - HTML + - Referencia +translation_of: Web/HTML/Global_attributes/contextmenu +--- +

{{HTMLSidebar("Global_attributes")}}

+ +

El atributo global  contextmenu es el  id de un  {{HTMLElement("menu")}} para nosotros como el menu contextual para este elemento .

+ +

Un menu contextual  es un menu que aparece sobre la interacción del usuario , como por ejemplo un click derecho . HTML5 ahora permite modificar este menú . Aquí hay unos ejemplos de implementación , incluyendo menús anidados .

+ +
+

Ejemplo

+ +

 

+ +
<body contextmenu="share">
+  <menu type="context" id="share">
+    <menu label="share">
+      <menuitem label="Twitter" onclick="window.open('https://twitter.com/intent/tweet?text=Hurra! Estos aprendiendo sobre ContextMenuI en MDN a través de Mozilla ');"></menuitem>
+      <menuitem label="Facebook" onclick="window.open('https://facebook.com/sharer/sharer.php?u=https://https://developer.mozilla.org/en/HTML/Element/Using_HTML_context_menus');"></menuitem>
+    </menu>
+  </menu>
+  <ol>
+    <li>En cualquier parte del ejemplo puedes compartir la página en twitter y Facebook usando el menú de compartir de tu menú contextual.</li>
+    <li><pre contextmenu="changeFont" id="fontSizing">En este elemento específico de la lista , puedes cambiar el tamaño del texto usando  las acciones "Incremenrar/Decrementar" de tu menú contextual ./pre></li>
+    <menu type="context" id="changeFont">
+      <menuitem label="Increase Font" onclick="incFont()"></menuitem>
+      <menuitem label="Decrease Font" onclick="decFont()"></menuitem>
+    </menu>
+    <li contextmenu="ChangeImage" id="changeImage">En la imagen de abajo , puedes accionar la accion "Cambio de Imagen " en tu menú contextual .</li><br />
+    <img src="https://developer.mozilla.org/media/img/promote/promobutton_mdn5.png" contextmenu="ChangeImage" id="promoButton" />
+    <menu type="context" id="ChangeImage">
+      <menuitem label="Change Image" onclick="changeImage()"></menuitem>
+    </menu>
+  </ol>
+</body>
+
+ +

en conjunto con este Javascript

+ +
function incFont(){
+  document.getElementById("fontSizing").style.fontSize="larger";
+}
+function decFont(){
+  document.getElementById("fontSizing").style.fontSize="smaller";
+}
+function changeImage(){
+  var j = Math.ceil((Math.random()*39)+1);
+  document.images[0].src="https://developer.mozilla.org/media/img/promote/promobutton_mdn" + j + ".png";
+}
+ +

resulta en :

+ +
{{EmbedLiveSample("ContextMenu_Example",550,200)}}
+
+ +

Especificaciones

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', "forms.html#attr-contextmenu", "contextmenu")}}{{Spec2('HTML WHATWG')}}Sin cambio desde el último snapshot, {{SpecName('HTML5.1')}}
{{SpecName('HTML5.1', "interactive-elements.html#context-menus", "contextmenu")}}{{Spec2('HTML5.1')}}Snapshot de {{SpecName('HTML WHATWG')}}, definición inicial.
+ +

Compatibilidad en exploradores

+ +

{{ CompatibilityTable() }}

+ +
+ + + + + + + + + + + + + + + + + + + +
CaracterísiticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Soporte básico{{ CompatNo }}{{ CompatGeckoDesktop(9) }}{{ CompatNo }}{{ CompatNo }}{{ CompatNo }}
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Soporte básico{{ CompatNo }}{{ CompatNo }}{{ CompatGeckoDesktop(20) }}{{ CompatNo }}{{ CompatNo }}
+
+ +

Ver también

+ + -- cgit v1.2.3-54-g00ecf