Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't get a trigger box to open
    primarykey
    data
    text
    <p>I'm trying to add a small 'trigger box' that will open upon click. It used to work a while ago, but I'm not sure what is exactly wrong now. </p> <p>I've learned a bit of HTML and CSS so I understand what's going on with those sections, but I barely know Javascript. So everything within the script selector is new to me; someone else online provided it and I'm trying to understand it. Reading the syntax, I think I know what's happening, but I still don't know what the problem exactly is.</p> <p>Here's the code I have. Yes, it's all in 1 HTML file because this is for just 1 page.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; This is the Title &lt;/title&gt; &lt;style type="text/css"&gt; html, body { color:#666; font:"Times New Roman", Times, serif; } h1 { font-size:36px; color:#333; margin:0 0 15px 0; padding:0 0 15px 0; border-bottom: solid 1px #e1e1e1; } .awesomeBox { border:solid 1px #cacaca; box-shadow: 0 0 3px #bbb; padding:15px; margin:20px; width:400px; } .trigger { cursor:pointer; } /* this is all you need to make the hidden box hidden :) */ .hiddenBox { display:none; } /* we put a little style to the trigger */ .box { position:relative; } .box .trigger { font-size:12px; background:#cacaca; padding:5px 10px; color:#fff; text-decoration:none; position:absolute; bottom:-42px; right:0; } .box .hiddenBox { background:#f9f9f9; color:#000; padding:10px; margin:10px; } &lt;/style&gt; &lt;script src = "//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt; $(function() { $(".trigger").on("click", function() { $(".hiddenBox").toggle(); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="awesomeBox"&gt; &lt;h1 class="trigger"&gt;Le awesome Page&lt;/h1&gt; &lt;div class="box"&gt;The area where you could type a lot of text but also want to hide some text&lt;br&gt; &lt;p&gt;So, user will press the read more button.&lt;/p&gt; &lt;a href="#" class="trigger"&gt;Read more &amp;raquo;&lt;/a&gt; &lt;div class="hiddenBox"&gt; &lt;p&gt;A lot of text in this hidden box and ... a lot alot more fsdfsd &lt;/p&gt; &lt;img src="https://www.google.com/images/srpr/logo4w.png" width="100%" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload