<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Madhurima Mishra on Medium]]></title>
        <description><![CDATA[Stories by Madhurima Mishra on Medium]]></description>
        <link>https://medium.com/@madhurimamishra?source=rss-2cbe5e3a4397------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*51OarlNDdCmBP14d</url>
            <title>Stories by Madhurima Mishra on Medium</title>
            <link>https://medium.com/@madhurimamishra?source=rss-2cbe5e3a4397------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 08:19:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@madhurimamishra/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[This is really helpfull! Thank you for this ar]]></title>
            <link>https://madhurimamishra.medium.com/this-is-really-helpfull-thank-you-for-this-ar-dc20a38d364c?source=rss-2cbe5e3a4397------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc20a38d364c</guid>
            <dc:creator><![CDATA[Madhurima Mishra]]></dc:creator>
            <pubDate>Tue, 16 Apr 2024 15:16:10 GMT</pubDate>
            <atom:updated>2024-04-16T15:16:10.217Z</atom:updated>
            <content:encoded><![CDATA[<p>This is really helpfull! Thank you for this article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc20a38d364c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Playing with CSS variable and JS]]></title>
            <link>https://madhurimamishra.medium.com/playing-with-css-variable-and-js-88b8bfd422b?source=rss-2cbe5e3a4397------2</link>
            <guid isPermaLink="false">https://medium.com/p/88b8bfd422b</guid>
            <dc:creator><![CDATA[Madhurima Mishra]]></dc:creator>
            <pubDate>Sun, 22 Nov 2020 16:35:31 GMT</pubDate>
            <atom:updated>2020-11-22T17:24:49.255Z</atom:updated>
            <content:encoded><![CDATA[<h3>Using JavaScript to play with CSS Variables</h3><p>I will be building a simple app to play with CSS variables. Here is the <a href="https://madhurima-ms.github.io/Update-CSS-with-JS/"><em>link</em></a> of the app that we will be creating in this article.</p><p>In this article we will learn about how to change CSS property of class using JavaScript. Here we set up and instantiate CSS variables at the highest level within CSS. Then we apply event listeners for the input fields so that we trigger a function anytime the input is scrolled or changed.</p><h3>Knowledge of the following is required</h3><ol><li>HTML</li><li>CSS</li><li>JS : JavaScript Classes, function, Event Listener</li></ol><h3>We start by writing our HTML code:</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1396df6491e0b76204afcbf526fe9286/href">https://medium.com/media/1396df6491e0b76204afcbf526fe9286/href</a></iframe><p>In this case we need px for the blur and border. We get the values from the dataset which holds data-sizing for all the inputs.</p><h3><strong>css code</strong></h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f0ae76f9a708674550382d4484e7987b/href">https://medium.com/media/f0ae76f9a708674550382d4484e7987b/href</a></iframe><p>The traditional method of using native CSS variables is adding it to root</p><pre>:root {</pre><pre>--base: yellow;</pre><pre>--blur: 05px;</pre><pre>--spacing: 10px;</pre><pre>}</pre><p>After defining the variable in root we have to use the custom variable on img in css</p><pre>img {</pre><pre>padding: var(--spacing);</pre><pre>background: var(--base);</pre><pre>filter:blur(var(--blur));</pre><pre>}</pre><p>To highlight the JS variable colour dynamically in the page which has been used in HTML</p><pre>.hl{<br>color: var(--base);</pre><h3>With our HTML and CSS set up, we have something like this:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9045voc9lASchpMwB9iABA.png" /></figure><h3><strong>JavaScript code</strong></h3><p>The inputs for changing the variable are bound by the name of the input and the variable name. From there we set the value of the variable to a custom value using Javascript.</p><ol><li>Defining the &lt;input&gt; object on Javascript.</li></ol><p>List of all of the inputs we need to see if any of them are being changed. Inputs’ which contains all HTML inputs in a nodeList:</p><pre>const inputs = document.querySelectorAll(&#39;.controls input&#39;);</pre><p>2. Created a single fallback function (handleUpdate) for all events and used a JS method.</p><p>We need to declare some attributes and initialise a default values to these attributes in order to handle the update process.</p><p>3. Created a ‘suffix’ constant and a ‘nil’ default value.</p><p>The suffix is there to get the sizing from the HTML element. In this case we need it to say px for the blur and border. We get the values from the dataset which holds data-sizing for all the inputs.</p><pre>const suffix = this.dataset.sizing || &#39;&#39;;</pre><p><em>this.dataset property returns a </em><a href="https://developer.mozilla.org/en-US/docs/Web/API/DOMStringMap"><em>DOMStringMap</em></a><em> </em>interface is used for the HTML element attribute, to represent data for custom attributes added to elements.</p><p>4. To now change the variables, or custom properties, based on the inputs we call the setProperty method on the root element.</p><p>name attribute for printing the name of the css variable into the markup by JavaScript. value attribute for printing the current value of the input into the markup on change and mousemove events.</p><pre>document.documentElement.style.setProperty(`--${this.name}`, this.value + suffix);</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d71b4908668d8c37bdb86b09abf1d97/href">https://medium.com/media/6d71b4908668d8c37bdb86b09abf1d97/href</a></iframe><h4>A complete package of HTML, CSS and JS set up, we have the final look:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aSfxH8_OCVYSe383LCSbUg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88b8bfd422b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Clock With JavaScript]]></title>
            <link>https://madhurimamishra.medium.com/creating-a-clock-with-javascript-4f75b724e8b6?source=rss-2cbe5e3a4397------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f75b724e8b6</guid>
            <dc:creator><![CDATA[Madhurima Mishra]]></dc:creator>
            <pubDate>Wed, 18 Nov 2020 17:40:32 GMT</pubDate>
            <atom:updated>2020-11-20T14:56:12.882Z</atom:updated>
            <content:encoded><![CDATA[<p>I have been learning JavaScript and in the course of that I came cross Wes Bos’s JavaScript30 course(<a href="https://javascript30.com/"><strong>https://javascript30.com/</strong></a><strong>)</strong>.<strong> </strong>It was highly recommenced in online communities so I thought of following along the course. Of the first few projects, one is “Building a Clock with Vanilla JS, HTML and CSS”.</p><p>Here in this article we will go through the steps to do that project.</p><p>We will create a clock with JavaScript which takes current time from the JavaScript and it will update its hands based on the current second, minute and hour hand. This article explains about how to build a clock</p><h3><strong>Knowledge of the following is required</strong></h3><ol><li>HTML</li><li>CSS</li><li>JS : JavaScript Classes, Functions, Event Listener</li></ol><h3>We start by writing our HTML code</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/51301db1e540c5e34a84c40505822bed/href">https://medium.com/media/51301db1e540c5e34a84c40505822bed/href</a></iframe><p>We add classes to the HTML code to enable us to style it with CSS and data attributes to target it with javascript.</p><h3>CSS for clock</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c254d0aa037306413134c308224f5be1/href">https://medium.com/media/c254d0aa037306413134c308224f5be1/href</a></iframe><p>3 Hand div in index is used as default. We are going to apply a rotate to each of the hand depending upon on what time it currently is. So Now to turn the hands based on the time, we first need to set the transform-origin because by default the origin from which we transform an element is from the centre(or 50%). All of our hands are positioned in such a way that we want to transform them from the right, so we set transform-origin: 100% and transform: rotate(90deg) to make sure the hands are facing upwards at 12 o’clock.</p><h4>With our HTML and CSS set up, we have something like this:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*8Cjoku-QI7VaXIJu2WsF2Q.png" /></figure><h3>JavaScript Code</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/08724edd938e0409f2aaf3c8ea26bca6/href">https://medium.com/media/08724edd938e0409f2aaf3c8ea26bca6/href</a></iframe><p>The three variables here are hourHand, minuteHand and secHand used to target our elements with the data attributes attached to it in the HTML file.</p><p>Next thing is to create a class that will hold the function <strong>set date().</strong></p><p>The <strong>set date()</strong> function represent the current date. <strong>Now</strong> variable is assigned to hold the value of current date.</p><p>To get the seconds, minutes and hours here’s what you do:</p><pre>const seconds= now.getSeconds();<br>const mins= now.getMinutes();<br>const hour= now.getHours();</pre><p>Each 60 second prepares minute hand for its next position, and each 60 minutes tick does same for the hour hand.</p><pre>const minsDegrees = ((mins / 60)</pre><p>After getting the seconds of the current minute, and in order to get the degrees you should divide the minutes, and hours by 60, 12, respectfully and multiple by each by 360.</p><p>const hourDegrees = ((hour / 12) * 360) + ((mins/60)*30) + 90;</p><p>It’s a basic percentage calculation. Part divided by whole times 100%, or in this case 360 degrees. We add the 90 degrees because we’ve offset all of the hands 90 degrees to turn them upwards.</p><p>We’ll put everything inside a function and run that function in every second. The most common way to do that is with a <strong>setInterval</strong> with which we call a function every 1000ms.</p><pre>setInterval(setDate,1000);</pre><h3>Final look</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*0SwaGBLRPdHXW-TM5kHpBA.png" /></figure><p>Find the associated code of the article here: <a href="https://github.com/madhurima-ms/js_30daysProjects/tree/main/jsclock">https://github.com/madhurima-ms/js_30daysProjects/tree/main/jsclock</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f75b724e8b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>