Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You have to use an API from each site to get the buttons/badges. For example, you have to review the docs for the Facebook like button: <a href="https://developers.facebook.com/docs/reference/plugins/like/" rel="nofollow">https://developers.facebook.com/docs/reference/plugins/like/</a> and get the code that way.</p> <p>To create the menu: </p> <p>Make a share button using a <code>div</code>, then put another <code>div</code> after it, which is the menu. Style to your liking. Then, make the menu <code>display: none</code> - this will hide it. Use JS to bind the button's click event to a function that shows the menu:</p> <p><strong>HTML</strong></p> <pre><code>&lt;div class="share"&gt;Share&lt;/div&gt; &lt;div class="menu"&gt; &lt;ul&gt; &lt;li&gt;Facebook&lt;/li&gt; &lt;li&gt;Twitter&lt;/li&gt; &lt;li&gt;Stack&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p><strong>CSS</strong></p> <pre><code>.menu { display: none; } </code></pre> <p><strong>JS</strong></p> <pre><code>$('body').on('click', function (e) { if (e.target.className !== 'share') $('.menu').css('display', 'none'); else $('.menu').css('display', 'block'); }); </code></pre> <hr> <p>So your entire HTML file should look like:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;style&gt; .menu { display: none; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="share"&gt;Share&lt;/div&gt; &lt;div class="menu"&gt; &lt;ul&gt; &lt;li&gt;Facebook&lt;/li&gt; &lt;li&gt;Twitter&lt;/li&gt; &lt;li&gt;Stack&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;!-- This is the jQuery --&gt; &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt; $('body').on('click', function (e) { if (e.target.className !== 'share') $('.menu').css('display', 'none'); else $('.menu').css('display', 'block'); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

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