Tag Archives: javascript

SetTimeout random interval in javascript

by in on

Just few days back i got a request for my client to making a script that Increment Number with random interval. Then i thought to make a small plugin that generates random interval. How it works, is start number increments with a default value (1000) and set a cookie to user’s browser and every time this script update the cookies value so that when the user refresh there browser he/she get the same last incremented value. You can control the setTimeout random interval to change the value in the following line var rand = Math.round(Math.random() * (2000 - 200)) + 200;

Random hex color Generator JavaScript

by in on

Short and effective script to generate random hex color. We start with random number to multiply with white color (Hex Code is 0xFFFFFF ), now we have to convert the random generated values into the hexadecimal value to display the color. To convert integer values into hexadecimal i have used .toString( radix ) where:

  • 2 – The number will show as a binary value
  • 8 – The number will show as an octal value
  • 16 – The number will show as an hexadecimal value

JavaScript on page scroll animation

by in on

on-page-scroll-animation-webomnizz

Here is the easiest way to animation on page scroll. We just have to check the scrolled amount during page scroll, and there is a lot of ways and the free plugin to achieve that but in this post we are using the simple javaScript. You have to attach an event on page scroll.

Simple and attractive javascript plotting chart

by in , , on

if we talking about the data representation, like total sale or total visits on day-by-day etc. then it’s a great idea to showing the data into plotting chart. When i have this idea to represent the data in plotting chart then i got a JavaScript plug-in on flotcharts.org, one to the simplest and attractive javascript plotting chart plug-in. Below you get that how to start with this plugin in a simplest way, means just the starting of the plotting chart plug-in.

First make your document ready like usually we are doing before running any jquery stuff. After that just call the plotting chart plugin’s function ‘$.plot()’ and start to input the data that you want to display on your chart. First you have to mention, in which element you want to show your chart. As you see in the HTML section, i have created a div with the class name ‘graph’. And in the jquery section just call the call or whatever you element you want.