<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>javascript morris js twitter bootstrap on random thoughts</title><link>https://awesomeprogrammer.com/categories/javascript-morris-js-twitter-bootstrap/</link><description>Recent content in javascript morris js twitter bootstrap on random thoughts</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sun, 20 Jan 2013 00:00:00 +0000</lastBuildDate><atom:link href="https://awesomeprogrammer.com/categories/javascript-morris-js-twitter-bootstrap/index.xml" rel="self" type="application/rss+xml"/><item><title>Morris.js display:none workaround</title><link>https://awesomeprogrammer.com/blog/2013/01/20/morris-dot-js-display-none-workaround/</link><pubDate>Sun, 20 Jan 2013 00:00:00 +0000</pubDate><guid>https://awesomeprogrammer.com/blog/2013/01/20/morris-dot-js-display-none-workaround/</guid><description><![CDATA[<p><a href="http://www.oesmith.co.uk/morris.js/">Morris.js</a> is great, simple and lightweight charts library powered by jQuery and Raphael. Unfortunately you may encounter an issue when you will try to plot a chart on element with <code>display:none</code> property - for example when using Twitter&rsquo;s Bootstrap tabbed component - it just doesn&rsquo;t render properly. So as a quick workaround you can fire-up <em>after</em> showing that element.</p>
<p>Bootstrap provides some neat javascript events that are fired after some specific actions. So when you dive in into <a href="http://twitter.github.com/bootstrap/javascript.html#tabs">documentation</a> you will find out that you can catch <code>shown</code> even that is fired after the tab has been shown. Just like that:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;a[data-toggle=&#34;tab&#34;]&#39;</span>).<span style="color:#a6e22e">on</span>(<span style="color:#e6db74">&#39;shown&#39;</span>, <span style="color:#66d9ef">function</span> (<span style="color:#a6e22e">e</span>) {
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">e</span>.<span style="color:#a6e22e">target</span> <span style="color:#75715e">// activated tab
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>  <span style="color:#a6e22e">e</span>.<span style="color:#a6e22e">relatedTarget</span> <span style="color:#75715e">// previous tab
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>})
</span></span></code></pre></div><p>Just create a simple snippet and you are good to go.</p>
]]></description><content:encoded><![CDATA[<p><a href="http://www.oesmith.co.uk/morris.js/">Morris.js</a> is great, simple and lightweight charts library powered by jQuery and Raphael. Unfortunately you may encounter an issue when you will try to plot a chart on element with <code>display:none</code> property - for example when using Twitter&rsquo;s Bootstrap tabbed component - it just doesn&rsquo;t render properly. So as a quick workaround you can fire-up <em>after</em> showing that element.</p>
<p>Bootstrap provides some neat javascript events that are fired after some specific actions. So when you dive in into <a href="http://twitter.github.com/bootstrap/javascript.html#tabs">documentation</a> you will find out that you can catch <code>shown</code> even that is fired after the tab has been shown. Just like that:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#a6e22e">$</span>(<span style="color:#e6db74">&#39;a[data-toggle=&#34;tab&#34;]&#39;</span>).<span style="color:#a6e22e">on</span>(<span style="color:#e6db74">&#39;shown&#39;</span>, <span style="color:#66d9ef">function</span> (<span style="color:#a6e22e">e</span>) {
</span></span><span style="display:flex;"><span>  <span style="color:#a6e22e">e</span>.<span style="color:#a6e22e">target</span> <span style="color:#75715e">// activated tab
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>  <span style="color:#a6e22e">e</span>.<span style="color:#a6e22e">relatedTarget</span> <span style="color:#75715e">// previous tab
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>})
</span></span></code></pre></div><p>Just create a simple snippet and you are good to go.</p>
]]></content:encoded></item></channel></rss>