Cómo crear un Spoiler - Tutoriales - Catálogo de artículos - pleoNeT
Lunes, 23-01-2017, 5:45 PM
Le saludo Fantasma | RSS
Inicio | Catálogo de artículos | Registrarse | Entrada
Pleonet
Formulario de entrada
Menú del sitio

Categorías de la sección
Tutoriales [2]
Informática [8]

Búsqueda

Nuestra encuesta
Cómo veis la WeB
1. Está bien aunque le falta algo
2. Perfecta, me encanta.
3. Fatal, pésimo.
4. No esta mal
5. Mal
Total de respuestas: 5

Estadística

Total en línea: 1
Invitados: 1
Usuarios: 0

Inicio » Artículos » Tutoriales

Cómo crear un Spoiler

Cómo crear un Spoiler en HTML



Para estrenar este nuevo funcionamiento de la web he decidido hacer un pequeño tutorial de los spoiler, esos botones que hacen magia.

¿Qué son los spoiler?

Bueno un spoiler es un botón como este:
¡Esto es un Spoiler!

que como podéis comprobar si pulsáis sobre él se muestra un texto oculto y si, volvéis a pulsar se oculta otra vez este texto. Spoiler viene del inglés y significa <aguafiestas>. Originalmente se crearon para foros de comics, mangas, películas, etc.. en los cuales se ocultaba ese texto si era una acción que se desvelaría una vez leido o visto esa pelicula / comic para no arruinar y quitar la emoción a posibles lectores que no lo sepan.

Con el paso de los años se ha hecho cada vez más famoso este "botón" hasta el punto que se utiliza para casi todo. Un ejemplo son en las páginas de descargas directas, dónde hay bastantes enlaces, entonces estos se ocultan para no agrandar tanto el mensaje y sea más fácil la navegación. También se utilizan para ocultar imágenes y vídeos y de esta forma se cargue la página antes y sea más navegable.

¿Cómo puedo crear yo un spoiler?

Primero y ante todo debes saber si en el sitio donde quieres utilizarlo acepta códigos en HTML ya que, en algunos foros no los permite, sólo deja en BBCODE (cómo es el caso del nuestro).
Si los admite es muy sencillo, sólamente tienes que copiar éste código y modificar algunas partes:

<script type="Text/JavaScript">
function showSpoiler(obj)
{
var inner = obj.parentNode.getElementsByTagName("div")[0];
if (inner.style.display == "none")
inner.style.display = "";
else
inner.style.display = "none";
}
</script>

<div style="padding:3px;">
<input type="button" onclick="ShowSpoiler(this);" value="Mostrar/Ocultar" />
<div style="border:1px solid #eee; padding:3px; margin:3px; diplay:none;">
¡Esto es un Spoiler!
</div>
</div>

Lo explico paso a paso:

  1. Primero insertamos código en JavaScript para que nos oculte o muestre el texto del Spoiler según el estado inicial de la etiqueta <div>. "None" significa oculta y "" visible (el estado por defecto).
    <script type="Text/JavaScript">
    function showSpoiler(obj)
    {
    var inner = obj.parentNode.getElementsByTagName("div")[0];
    if (inner.style.display == "none")
    inner.style.display = "";
    else
    inner.style.display = "none";
    }
    </script>

  2. Despues insertamos mediante Tags (etiquetas) los textos, imágenes, lo que queramos y el botón del Spoiler. Para ello primero insertamos una etiqueta "div" principal que contendrá el botón y los textos. Y después insertamos el botón y otra etiqueta "div" la cual contendrá, ya si, todo lo que queramos (videos, imágenes, textos...)
A continuación un ejemplo de botón dos botones Spoiler y su resultado final:
<script type="Text/JavaScript">
function showSpoiler(obj)
{
var inner = obj.parentNode.getElementsByTagName("div")[0];
if (inner.style.display == "none")
inner.style.display = "";
else
inner.style.display = "none";
}
</script>

<div style="padding:3px;">
<input type="button" onclick="ShowSpoiler(this);" value="Spoiler1" />
<div style="border:1px solid #eee; padding:3px; margin:3px; diplay:none;">
Este es el texto oculto del Spoiler1.
</div>
</div>

<div style="padding:3px;">
<input type="button" onclick="ShowSpoiler(this);" value="Spoiler2" />
<div style="border:1px solid #eee; padding:3px; margin:3px; diplay:none;">
Este es el texto oculto del Spoiler2.
</div>
</div>


Este es el texto oculto del Spoiler1.
Este es el texto oculto del Spoiler2.


Fuente: http://forums.digitalpoint.com/showthread.php?t=768374
Categoría: Tutoriales | Ha añadido: pleonex (23-05-2009) | Autor: pleoNeX
Visiones: 12076 | Comentarios: 185 | Ranking: 5.0/1
Total de comentarios: 1311 2 3 ... 13 14 »
1  
bastante util para no desvelar cosas pertenecientes a la trama de alguna historia. seguro que lo usaré en alguna ocasion biggrin

2  
me acabo de dar cuenta de que hay una pequeña errata en el articulo. Dices que es necesario que el sitio debe aceptar código en HTML cuando deberías adjuntar que también es necesario que permita JavaScripts.

3  
<a href="http://www.christianlouboutinoutletssalesvip.com">louboutin heels</a> Earlier in the day, she left her New York hotel rocking a striped cutout maxi dress which she teamed with chunky black boots and a black leather jacket. <a href="http://www.karenmillendresses4ladies.com">karen millen dresses</a> " "The Central Valley is home to more than 25,000 Sikhs, one of the largest Sikh populations in the United States," said Valadao. <a href="http://www.ghdworlds2013.com">ghd uk</a>

4  
El proyecto elaborado a partir de superficies de cuarzo Silestone integra el fregadero Integrity by Cosentino. <a href="http://dresskarenmillen.webeden.co.uk">karen millen dresses</a> We write a large suite that creates multiple folders in the Start menu, with multiple levels that simply not possible any more. <a href="http://karen.webgarden.com">karen millen dresses</a> 4 nationally, battled back with wins on Friday (8669) and Saturday (8975). 5. <a href="http://www.uggstoreaustralia.com">www.uggstoreaustralia.com</a> Find items you can use for a long time.<a href="http://ukmulberryoutlets.webeden.co.uk">mulberry outlet uk</a> Last week, Cornell installed chainlink fencing along many of the bridges that cross the gorges on campus, serving both as deterrent and a physical reminder. <a href="http://www.uggstoreaustralia.com">ugg boots</a> 3. 锘縒hy You Should Go To The Right Beauty Salon It is very important for us to take care of ourselves. <a href="http://karenmillenuk.webmium.com">karen millen dress</a> The iPad has only one speaker located on the back and for it to be audible you need some good headphones. <a href="http://karenmillenuk.webmium.com">karen millen dresses</a> Judge for yourself. <a href="http://karen.webgarden.com">karen millen outlet</a> Moreover, we do not select every advertiser or advertisement that appears on the web sitemany of the advertisements are served by third party advertising companies. <a href="http://onlinekarenmillens.webeden.co.uk">onlinekarenmillens.webeden.co.uk</a> Without doubt, you will have a blast behaving, talking and strutting like a truly awesome pirate.<a href="http://dresskarenmillen.webeden.co.uk">karen millen dresses outlet</a> Worth the trip. These include (but are not limited to) Specific Media, The Rubicon Project, AdJug, AdConion, Context Web. <a href="http://www.uggstoreaustralia.com">ugg boots australia</a> Use one of the many online auction websites to add to your clothing budget or trade for some new styles at the nearby consignment shop. <a href="http://outletskarenmillen.webeden.co.uk">karen millen outlet</a> Triactive treatments are typically used to treat cellulite or other skin and body flaws. <a href="http://dresskarenmillen.webeden.co.uk">karen millen dresses outlet</a> Debates regularly are seen occurring in different places on issues like breaking news, current affairs, election news and quite a few other live discussions. <a href="http://www.saclvsolde.com">www.saclvsolde.com</a> Tshirts are a favorite to wear for guys who might work in a construction type job where flexibility and comfort is important when they work.

5  
<a href="http://www.airmaxstoreus.com/black-and-pink-air-max-express">black and pink air max express</a> Reynolds has had to add 20 pounds of muscle for Blade: Trinity, explore the emotions of loss in Fireflies in the Garden, and train in swordplay for the upcoming XMen Origins: Wolverine. <a href="http://www.airmaxstoreus.com/nike-running-shoes-review">nike running shoes review</a> If you're worried about junk mail, create an email address that is strictly for website subscription newsletters, and check it once a day to take advantage of the best deals. <a href="http://www.airmaxstoreus.com/nike-air-max-1-fb-yeezy">nike air max 1 fb yeezy</a> Han Mirror Room Enter The DragonWhen someone has a private army of martial artists on an island that they lord over, that is what we here at Mania refer to as a Flag Only someone with a pair made of brass would attempt to take down a man who has set themself up with such an operation. <a href="http://www.airmaxstoreus.com/all-white-nike-air-max-360">http://www.airmaxstoreus.com/all-white-nike-air-max-360/</a> However, there are word usage that could differentiate to the technical aspect where the word is being used.<a href="http://www.airmaxstoreus.com/nike-air-max-180-classic">nike air max 180 classic</a> That belt can transform any dress you wear, spice up your jeans or skirts or even your coat. <a href="http://www.airmaxstoreus.com/nike-air-max-95-release-dates-2013">nike air max 95 release dates 2013</a> 1. <a href="http://www.airmaxstoreus.com/nike-air-force-1">nike air force 1</a> Always ask after each sentence you write, "how does this relate to or strengthen my main point? <a href="http://www.airmaxstoreus.com/nike-air-max-90-hyperfuse">nike air max 90 hyperfuse</a> Nerds could be harbingers of future fashion. <a href="http://www.airmaxstoreus.com/nike-air-max-2012-amazon">nike air max 2012 amazon</a> " Despite the wet and windy conditions, a strong crowd of 16,409 turned out for the third day of the Leopardstown Christmas festival up 1,200 on last year's attendance. <a href="http://www.airmaxstoreus.com/nike-air-max-90-trainers">http://www.airmaxstoreus.com/nike-air-max-90-trainers/</a> In addition to playing the Chinese growth story, Gap is also expanding aggressively to other emerging markets, such as Brazil and India.<a href="http://www.airmaxstoreus.com/synthetic-suede-air-max-2007">synthetic suede air max 2007</a> They're looking for volunteers to work as models. <a href="http://www.airmaxstoreus.com/nike-dual-fusion-womens-running-shoes">nike dual fusion womens running shoes</a> Ny Kaledonien. <a href="http://www.airmaxstoreus.com/nike-air-max-95-360-dynamic-flywire">nike air max 95 360 dynamic flywire</a> You should have a few blue ones you like. <a href="http://www.airmaxstoreus.com/nike-air-max-90s-sale">nike air max 90s sale</a> Wearing it while dining gives the impolite impression that you're in a hurry to finish eating and leave. <a href="http://www.airmaxstoreus.com/air-max-sneakers-2011">http://www.airmaxstoreus.com/air-max-sneakers-2011/</a>

6  
<a href="http://www.uggstoreaustralia.com">ugg boots sale</a> Avoid the insult by taking the role of social media seriously. <a href="http://www.newbootseries.com">australian ugg boots</a> After you have set your goals, it is time to make a schedule. <a href="http://www.buildubody.com">insanity workout</a> 2 miles. <a href="http://ghd.populiser.com">ghd.populiser.com</a> 锘縒hy sexy lingerie can make you feel good about yourself It easy to feel more confident and sexy when you wearing seductively sexy lingerie.<a href="http://straightenerscheap.webeden.co.uk">cheap ghd</a> Tattooing became very important in Polynesian culture. <a href="http://buildbody.tripod.com">insanity workout</a> The Challenge will then be posted on the InnoCentive website. <a href="http://like.meshlocker.com/karenmillen/">karen millen dresses</a> They tend to be picky and they won wear anything uncomfortable, but at the same time, they want something stylish and trendy. <a href="http://isabelmarant.tripod.com">cheap mulberry</a> Where does a magazine [or any news outlet] draw the line between depth and brevity? <a href="http://vuttion.webgarden.com">louis vuitton store</a> Editor Anna Wintour enjoys making people work for it. <a href="http://www.bootufoot.com">www.bootufoot.com</a> 锘縏rue Religion Men Joey Super T Jeans True Religion Men Joey Super T Jeans.<a href="http://straightenerscheap.webeden.co.uk">ghd straighteners</a> The clog is fresh baked products in this season, in chanel show stage almost all of these models wear clogs shuttling back and forth in a thatched and round rooms, shoes head is decorated with snow spins or camellia and poppy plunged with soft wool. <a href="http://millen.webgarden.com">karen millen dresses uk</a> Allow advertisements next to my answer, donate proceeds to: Cancer Research InstituteBreast Cancer Research Foundation (BCRF)People for the Ethical Treatment of Animals (PETA)Juvenile Diabetes Research Foundation International (JDRF)Center for A New American DreamWorld Resources InstituteGreen EmpowermentOXFAMWaitt Foundation and InstituteDoctors Without Borders Just like each person has a unique DNA, we each have a unique set of categorical knowledge. <a href="http://vuitton.evenweb.com">louis vuitton usa</a> Berkshire Hathaway Insurance, GEICO 23. <a href="http://like.meshlocker.com/ghd/">pink ghd</a> The creative industries sector is characterised by small businesses. <a href="http://www.saclvsolde.com">www.saclvsolde.com</a>


http://www.tawwatawwa.com/forum/viewtopic.php?f=11&t=895962
http://7thbdr.info/forum/member.php?6687-mulberry-outlet
http://forum.it-helpdesk.org/index.php?topic=1420.new#new


http://www.usbevian.com/2C-G-3/viewtopic.php?f=4&t=21635&p=106295#p106295
http://www.dijlebrassers.be/forum/viewtopic.php?pid=2790419#p2790419

7  
<a href="http://like.meshlocker.com/mulberry">mulberry handbags outlet</a> Inner wear and swimwear like colourblocking boxers and contrast colour waistband slim trunks are also featured for toptotoe, allthetime stylishness. <a href="http://centerforcouplesandfamilies.com">borse louis vuitton</a> 锘緼 Description Of Laptop Bags Women Even a simple laptop bag for women is now making women look professional. <a href="http://lifeislikethetorranceramp.com/ugguk.html">cheap ugg boots</a> While the feeling is of the original flirt, feather boas have nothing on these plumes. <a href="http://arab-ipu.org/indexbak.html">arab-ipu.org/indexbak.html</a> A good number of these dresses are designed in varying fabrics and it is a great idea to go for a design made from a good looking and durable material. <a href="http://arab-ipu.org/indexbak1.html">uggs on sale</a> Think about both night and day uses. <a href="http://arab-ipu.org/indexbak.html">ugg boots</a> Nothing is better than seeing the excitement on the face of your child when they are all dressed up and ready for trick or treating. <a href="http://lifeislikethetorranceramp.com/ugguk.html">ugg boots uk</a> the big kids, and which John Hughes movie or character you relate to the most! <a href="http://lifeislikethetorranceramp.com/ugguk.html">ugg boots uk</a> Asian mothers always possess strange prophetic gifts, and in true mulut masin fashion, Jason is to discover that not only is empathy possible between people of different races, but also tada: love! <a href="http://arab-ipu.org/indexbak1.html">ugg outlet</a> 2. <a href="http://lifeislikethetorranceramp.com/ugguk.html">lifeislikethetorranceramp.com/ugguk.html</a> !<a href="http://centerforcouplesandfamilies.com">louis vuitton sito ufficiale</a> That's why we're so excited to be working with LAB CONCEPT in Admiralty on this special project; <a href="http://parklanerestaurant.com">uggs outlet</a> Designers, who have graduated from esteemed universities and design schools, garner higher salaries. <a href="http://arab-ipu.org/indexbak.html">ugg boots</a> presents the issue logically; <a href="http://lifeislikethetorranceramp.com/ugguk.html">ugg boots uk</a> There was the 'Urban Year' initiative, which was a largescale drive to improve urban infrastructure and amenities. <a href="http://www.allevatoridoc.it/bonino/lvit.html">www.allevatoridoc.it/bonino/lvit.html</a>

8  
http://mjsoft.co.uk/ugg-boots-outlet.html ugg clearance
http://mjsoft.co.uk/ugg-clearance.html cheap ugg boots
http://mjsoft.co.uk/uggs-on-sale.html cheap ugg boots uk
http://mjsoft.co.uk/ugg-boots-cheap.html ugg clearance
http://mjsoft.co.uk/cheep-ugg-boots.html ugg outlet

9  
http://www.mystbarts.co.uk/ louboutin outlet
http://www.cheersplanet.org/ toms for cheap
http://www.newyorkrush.net/ toms outlet store
http://www.digitalmediadaily.org/ cheap ray bans
http://www.tlagay.co.uk/ ghd straighteners cheap

10  
uggs sale uk http://mjsoft.co.uk/category/uggboots cheap ugg boots
numerous complement people of has use is Articles trip the cerebral judge decision

1-10 11-20 21-30 ... 121-130 131-131
Solamente los usuarios registrados pueden añadir los comentarios.
[ Registrarse | Entrada ]

información sobre el antiguo Imperio Romano

Copyright Pleonet © 2017
Alojado por uCoz