Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- pseudo-element



  Ways to check existence of JavaScript object

The design of JavaScript is not so sophisticated. It's very easy for us to make mistakes if we are not very careful when using JavaScript. For example, to check the existence of JavaScript object. Now we want to check whether a global object myObj exists or not, if it doesn't exist, we declare it. The pseudo code for this is : if(myObj not exist){ declare myObj; } You may think it's very easy to write the code. In fact, it is much more difficult than we may think. Juriy Zaytsev says there are m...

   JAVASCRIPT,OBJECT,EXISTENCE     2020-09-12 02:14:02

  Understand Virtual DOM

With the popularity of React, the internals and implementation of Virtual DOM has becoming top discussed topic in tech communities and interviews. This post will give an introduction of Virtual DOM and how to implement a simple Virtual DOM logic. How to understand Virtual DOM In early days, front end developers would update a webpage view based on the data status change(usually after making AJAX call). But it brings performance penalties when there is frequent update as it would cause page reflo...

   JAVASCRIPT,DOM,VIRTUAL DOM     2019-12-07 23:43:04

  How ScrollerJS works

ScrollerJS is a light weight number scroller module to be embedded in web apps. It provides fancy number scrolling animations. ScrollerJS supports both CSS transition and DOM animation to handle the animation needed. If CSS transition is supported in a browser, CSS transition will be the preferred option for animation. If in old browsers where CSS transition is not supported. DOM animation will be chosen automatically. How does the number scrolling actually work? To transition a number from 0 to...

   ScrollerJS,JavaScript,CSS,GitHub     2015-06-11 06:54:44

  Android create button tutorial

This tutorial assumes that you already have an activity and are using an XML layout. Open the layout XML and add the button element.  Assign an ID with the “@+id” operator.  The + tells Android to generate an ID for this element so that you can reference it in your Java files. This is an example. Your layout and text elements will probably be very different. In this example case, the ID of the button is “close”. <Button android:id="@+id/close" android:lay...

   Android,Simulator,Button,XML,Tutorial     2014-11-07 08:30:10

  JavaScript to open link in new window without being popup blocked

To ensure security and reduce spamming, modern browsers have implemented very strict rules on when a new window can be opened in a web page. Currently browsers restrict that any new web page to be opened in a new window must be initiated with an user action. The action is usually an user click event. Otherwise, a popup blocker would show on the browser address bar which indicates that something is blocked. To workaround this issue, normally you should implement the window open logic in a click e...

   JAVASCRIPT,IFRAME,NEW WINDOW,OPEN LINK     2018-09-22 04:29:30

  Microsoft is filing a new patent about transparent display

Microsoft is filing a new patent about transparent display screen, it may be used on augmented reality technologies of tablets, phones and laptops. Similar to the scenes in the movie Minority Report. Minority Report was showed in 2002, it described a world of 2054, at that time 3D technology is mature. But after 10 years of this movie, Microsoft not only invented the basis of this technology, but also make it more portable.Patent Bolt recently revealed a patent application of Microsoft about tra...

   Microsoft,Transparent display,3D,Patent     2012-05-10 05:31:16

  Best practices of front end optimization

1. Use DocumentFragment or innerHTML to replace complex elements insertion DOM operation on browser is expensive. Although browser performance is improved much, multiple DOM elements insertion is still expensive and will affect the page load speed. Assume we have an ul element on our page, we now want to retrieve a JSON list using AJAX and then update the ul using JavaScript. Usually we may write it as : var list = document.querySelector('ul'); ajaxResult.items.forEach(function(item) { // ...

   JavaScript,Front end,Optimization,Tips     2013-07-06 11:26:27

  Permutation algorithm with JavaScript

In secondary school, we have learned permutation. Basically, for n numbers, the number of permutations for these n numbers can be calculated to n! which is called 'n factorial'. But to display all the permutations on the screen, we need to use a recursive function. The problem is how to write this function.  Next I write a program to display the permutations for n numbers with JavaScript. First, we need to understand that from these n numbers, we can first take any one number from it, and t...

   JavaScript,Permutation,Algorithm,Impleme     2011-09-21 12:02:35

  CSS3 animation vs CSS3 transition

Both CSS3 animation and CSS3 transition can be used to transition an element in a webpage. They can be used to transition some CSS properties within a given period of time. They have many similarities. They do have a few differences as well. So an user needs to understand the differences between them in order to better use them in different scenarios. First, let's see an example on how to change the width of a div from 100px to 200px within 2 seconds when hovering on it. With CSS3 animation , th...

   CSS3 animation,CSS3 transition, Difference     2015-06-15 08:46:39

  Ensure triggering transitionend event in JavaScript

CSS3 Transition has been widely used in modern web app development to offer users animations. Traditionally animations of element in HTML are controlled by JavaScript. If fancy animation is desired, then third party plugins can be installed in browsers such as Flash, Silverlight, Java Applet etc. With CSS3, animations can be easily achieved like a charm. Transition is one of the many features provided by CSS3. It can be used to transit one element from one state to another state smoothly within ...

   CSS3 TRANSITION, TRANSITIONEND, FORCE FIRE TRANSITIONEND     2015-05-09 08:56:51