snipt

Ctrl+h for KB shortcuts

JavaScript

jQuery: pop-up content in defined area

1
2
3
4
5
6
// onmouseover == hover

$('.popup-1').hover(
       function() { $('#popup-region').html("<img src='sample.jpg'/>"); }, 
       function() { $('#popup-region').html(''); }
);
https://snipt.net/embed/f784861172bf3d2b2c6dd66f86123e13/
/raw/f784861172bf3d2b2c6dd66f86123e13/
f784861172bf3d2b2c6dd66f86123e13
js
JavaScript
6
2019-06-16T23:00:23
True
False
False
/api/public/snipt/22903/
jquery-pop-up-content-in-defined-area
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">// onmouseover == hover</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="nx">$</span><span class="p">(</span><span class="s1">&#39;.popup-1&#39;</span><span class="p">).</span><span class="nx">hover</span><span class="p">(</span> </span><span id="L-4"><a name="L-4"></a> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span> <span class="nx">$</span><span class="p">(</span><span class="s1">&#39;#popup-region&#39;</span><span class="p">).</span><span class="nx">html</span><span class="p">(</span><span class="s2">&quot;&lt;img src=&#39;sample.jpg&#39;/&gt;&quot;</span><span class="p">);</span> <span class="p">},</span> </span><span id="L-5"><a name="L-5"></a> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span> <span class="nx">$</span><span class="p">(</span><span class="s1">&#39;#popup-region&#39;</span><span class="p">).</span><span class="nx">html</span><span class="p">(</span><span class="s1">&#39;&#39;</span><span class="p">);</span> <span class="p">}</span> </span><span id="L-6"><a name="L-6"></a><span class="p">);</span> </span></pre></div> </td></tr></table>
jquery, js, mouseover, popup