Diferencia entre revisiones de «Referencia:Incrustación de Aplicaciones GeoGebra»

De GeoGebra Manual
Saltar a: navegación, buscar
(Página creada con «{{Referencia}} {{revisar}} {{Note|In case you want to embed your materials in a webpage without any programming, you can just tap the Share button on the material page and...»)
 
Línea 1: Línea 1:
 
{{Referencia}}
 
{{Referencia}}
 
{{revisar}}
 
{{revisar}}
{{Note|In case you want to embed your materials in a webpage without any programming, you can just tap the Share button on the material page and select Embed from the dialog that appears.  
+
{{Note|Si quieres incrustar tus materiales en una página web sin programar, puedes hacer clic en el botón Compartir de la página del material y seleccionar 'Incrustar' del cuadro de diálogo emergente. El método descrito en esta página, proporciona mejores resultados, mayor flexibilidad y permite una integración más profunda.}}
 
+
=Incrustar utilizando JavaScript=
The method described on this page provides better performance, more flexibility and allows deeper integration.}}
+
Puedes utilizar JavaScript para incrustar fácilmente Aplicaciones GeoGebra en tu sitio web e interactuar con ellas utilizando la [https://www.geogebra.org/manual/en/Reference:JavaScript JavaScript API].
=Embed using JavaScript=
+
Aquí encontrarás un ejemplo de página web que contiene applets incrustados:
You can use JavaScript to easily embed GeoGebra Math Apps into your website and interact with them using the [https://www.geogebra.org/manual/en/Reference:JavaScript JavaScript API].
 
Here is an example web page that shows how to embed applets:
 
  
 
* [http://dev.geogebra.org/examples/html/example2.html Live demo]
 
* [http://dev.geogebra.org/examples/html/example2.html Live demo]
 
* [https://github.com/geogebra/math-apps-examples/blob/master/html/example-multiple.html Source code]
 
* [https://github.com/geogebra/math-apps-examples/blob/master/html/example-multiple.html Source code]
  
You need to include the following three parts in your HTML file:
+
Se necesita incluir las siguientes tres partes en el archivo HTML:
  
{{Step|num=1}} The javascript library deployggb.js needs to be included with this tag:
+
{{Step|num=1}} La librería javascript deployggb.js se incluye con la siguiente etiqueta:
  
 
<pre>    <script src="https://cdn.geogebra.org/apps/deployggb.js"></script></pre>
 
<pre>    <script src="https://cdn.geogebra.org/apps/deployggb.js"></script></pre>
{{Step|num=2}} Create elements in which the applets should be embedded
+
{{Step|num=2}} Crea elementos en los cuales incrustar los applets
 
<pre>    <div id="applet_container1"></div>
 
<pre>    <div id="applet_container1"></div>
 
     <div id="applet_container2"></div></pre>
 
     <div id="applet_container2"></div></pre>
{{Step|num=3}} Configure and insert the applets
+
{{Step|num=3}} Configura e inserta los applets
 
<pre><script>   
 
<pre><script>   
 
     var applet1 = new GGBApplet({material_id: "17499", borderColor:"#55FF00"}, true);
 
     var applet1 = new GGBApplet({material_id: "17499", borderColor:"#55FF00"}, true);

Revisión del 14:00 4 oct 2017

Nota: Si quieres incrustar tus materiales en una página web sin programar, puedes hacer clic en el botón Compartir de la página del material y seleccionar 'Incrustar' del cuadro de diálogo emergente. El método descrito en esta página, proporciona mejores resultados, mayor flexibilidad y permite una integración más profunda.

Incrustar utilizando JavaScript

Puedes utilizar JavaScript para incrustar fácilmente Aplicaciones GeoGebra en tu sitio web e interactuar con ellas utilizando la JavaScript API. Aquí encontrarás un ejemplo de página web que contiene applets incrustados:

Se necesita incluir las siguientes tres partes en el archivo HTML:

1 La librería javascript deployggb.js se incluye con la siguiente etiqueta:

    <script src="https://cdn.geogebra.org/apps/deployggb.js"></script>

2 Crea elementos en los cuales incrustar los applets

    <div id="applet_container1"></div>
    <div id="applet_container2"></div>

3 Configura e inserta los applets

<script>  
    var applet1 = new GGBApplet({material_id: "17499", borderColor:"#55FF00"}, true);
    var applet2 = new GGBApplet({filename: "../ggb/sine-curves.ggb","showToolbar":true}, true);
    window.addEventListener("load", function() {
        applet1.inject('applet_container1');
        applet2.inject('applet_container2');
    });
</script>

The snippet above embeds one applet given by ID and one given by URL and injects them into elements with ids 'applet_container1' and 'applet_container2' respectively (the element ID is passed to the inject method) . For offline use you will need to specify the file using a base64 encoded string (press Ctrl+Shift+B to export ggbBase64 string to clipboard).

When used with the id parameter, the applet will be created using the dimensions (width and height) and the applet parameters defined in the material settings on GeoGebra Materials Platform. Optionally you can override these settings by passing them in the parameters. See Reference:Applet_Parameters for the list of all parameters.

In the example the parameter "showToolbar":true overrides the material setting from the file.

Examples

Offline and Self-Hosted Solution

We suggest you use use Math Apps from our CDN (cdn.geogebra.org) as shown above, but in case you need to use the materials offline or host all the necessary file yourself you can do so using the Math Apps Bundle. Download Math Apps Bundle The embed codes are almost the same as above, with two differences: the tag for including deployggb.js needs to be changed to

    <script src="GeoGebra/deployggb.js"></script>

and you need to include the following two lines below the definition of applet2

    applet1.setHTML5Codebase('GeoGebra/HTML5/5.0/web3d/');
    applet2.setHTML5Codebase('GeoGebra/HTML5/5.0/web3d/');
© 2024 International GeoGebra Institute