Styling the default browser scroll bar using CSS

Default Scroll Bar Add the below CSS code to your stylesheet ::-webkit-scrollbar { width: 4px; } ::-webkit-scrollbar-track { -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); } ::-webkit-scrollbar-thumb { -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); } This is what you get, a more beautiful Scroll Bar   Lets add some round corners and increase the width ::-webkit-scrollbar { width: …

Difference between localStorage, sessionStorage and cookies

localStorage, sessionStorage and cookies are all client storage solutions which store data as key/value pairs in the browser. localStorage and sessionStorage both extend Storage. There is no difference between them except for the intended “non-persistence” of sessionStorage. sessionStorage maintains a separate storage area for each given origin that’s available for the duration of the page …

contenteditable DIV tag directive

Are you looking for a super simple WYSWYG editor and you don’t want to include any heavy library into your application. Then why not make your own using just a div. Take a look at the below directive. myApp.directive(“contenteditable”, function() { return { restrict: “A”, require: “ngModel”, link: function(scope, element, attrs, ngModel) { function read() …

Inheritance in Javascript

Inheritance is a concept which says you can create a class from another class if you would like to use its properties. A parent cantalk and caneat, so can the child because child “is a” subclass of Parent. While most programming languages have the concept of classes, in javascript its all about objects inheriting from other …

Different ways of setting a value to a Javascript object

Different ways of setting a value to a Javascript object //create an object var myVar = {}; //1. set value using dot myVar.key = “myvalue”; //2. set value using square brackets myVar[“key2”] = “myValue2″ //3. set value using defineProperty Object.defineProperty(myVar,”key3”,{ value : “myValue3” }); Setting values using the dot syntax or square brackets is pretty easy …