Showing posts with label css. Show all posts
Showing posts with label css. Show all posts

A PLETHORA OF TRICKS TO OPTIMIZE CSS LIKE ADVANCED CSS TECHNIQUES


Demands of people have significantly change over the years and they expect every business to have their own website.
And NOT just website, end users and non-technical customers outwait there for interactive portal so that they can drop their orders, suggestions, feedbacks and complaints.
Once an interactive eCommerce style shop is established and you can see significant traffic over the days and during peak hours in a tool like Google Analytics, next issue you want to resolve would be to minimize response time.
Apart from database configurations and optimizing code of server side programming language, we can employ various CSS techniques for this as below.
  • write reusable and modular CSS
  • Best practices for cross-browser and accessible CSS
  • keep branding consistent
  • quickly get new CSS developers up and running
  • incorporating CSS into builds and deployments
  • maximize performance of your website(s)
  • Dynamic CSS techniques

A plethora of tricks to optimize CSS like advanced CSS techniques, CSS3 selectors/properties, and different CSS design patterns.
We have resolved challenges while working in large teams on large sites with many pages or subsites that receive considerable traffic.

Scroll-linked effects to add sprinkle in webpages

http://www.blisswebsolution.com/scroll-linked-effects-to-add-sprinkle-in-webpages/

Technologies used for generating scroll-linked effects
 
HTML5 and CSS3 are undoubtedly way for the future, alike back end components, where there are multiple options or alternatives available and competing for each other,  like that for
  • back end programming language
  • database server
  • web server
  • mail server
or be it choice of operating system itself but truly there is NO technology that can be substituted in place of HTML and CSS, at least as of this writing.
 
However, we are going to discuss only little and specific bit of front end technologies here: power of and performance consequences of scrolling effects generated through CSS or JavaScript.
We all know that user interfaces(UI) are highly matured these days and we people like to enjoy interactivity, animations, pop-ups etc. on a webpage.  They add life and depth to web applications and improve user experience through the discrete use of CSS effects like transitions and animations. Scrolling effect is just one candidate in a bunch of such effects stimulated in response to HTML events and  adds sprinkle to website and BUIs(Browser User Interfaces).
 
What are scroll-linked effects and its types
A scroll-linked effect is an effect implemented on a webpage where change is followed by altering position of the scroll, for example updating a positioning property with the aim of producing a parallax scrolling effect. The scroll-linked effects have impact on performance and possible mitigation techniques are also available.
Scrolling effects are triggered after listening for the HTML scroll event and then it usually updates elements on the page in some way.  CSS Scroll API defines about a dozen  of such effects including
  1. Hidey bars: Scrolling down in the bar moves with the container, and when mouse is outside of bars, the bar disappears.
  2. Scroll header: When adjusting scrollTop=0,  header smoothly animates into a more substantial element like on images, text size animate with scroll position.
  3. Parallax: The position of elements on the page is affected by the scroll position of their container. Other attributes like opacity or a filter effect may be changed.
  4. Linked scrollers: Multiple elements on the same page are scrolled together with different rates but they do not overlap.
All these effects work pretty well in browsers supporting synchronization on their  main thread. However, most browsers including Firefox*(from version 40 onwards) now are capable to support some sort of asynchronous scrolling, meaning  when we make a web server call like that for accessing a web service, we will not have to wait till the server sends the response, other activities can be continued.
 
*We just need to alter this parameter to true in Firefox for this purpose:
layers.async-pan-zoom.enabled
Taking advantage of this, hypertext processing engines like CSS or JavaScript can render consistent 60 frames per second for the sake of  the user experience.
In the asynchronous scrolling model, the scroll position is updated in the compositor thread and then immediately, effect is visible to the user even before the scroll event is committed in the DOM and executed on the main thread. This means that the effects implemented will lag a little bit behind what the user has seen for the scroll position. This can cause ultimate outcome to be leggy or jittery and we need to put logic to avoid it.
 
Proposition and implementation to overcome unwanted consequences of scroll-linked effects 
Let us understand this with an elaborate example.
Bellow code snippet implements sticky-positioning effect where the "toolbar" div will stick to the top of the screen when you scroll down.
onscroll="document.getElementById('toolbar').style.top = Math.max(100, window.scrollY) + 'px'">
style="position: absolute;
 top: 100px;
 width: 100px;
 height: 20px;
 background-color: green">


This implementation of sticky positioning relies on the scroll event listener that makes toolbar div continuously repositioning to top.
The scroll event listener will run with the JavaScript engine in asynchronous manner on the browser's main thread.  Here,  asynchronous means NOT in step-by-step order relative to the user-visible scrolling.
Therefore, with asynchronous scrolling, the event handler will be delayed or will be executed afterwards relative to the user-visible scroll. This will make the div tag’s execution in jittery way, that is first it is run and then it " snaps" back into position when the scroll event handler runs.
 One way to overcome this problem is to avoid  the scroll event listener and instead  use the CSS property designed for this purpose and it will reduce overhead also, see following


id="toolbar"
 style="position: sticky;
 top: 0px;
 margin-top: 100px; width: 100px; height: 20px;
 background-color: green">



Final thoughts and summary
Websites are places for businesses, individuals and organizations to provide easily accessible information to interested visitors without having to arrange physical location meetings. Websites possessing fancy CSS effects like Parallax represent a lousy way of showcasing information, may make visitors to stay more time on site or take engagement to the next level.
 
However, they do NOT necessarily result in reducing any step in generating lead and may even make navigation difficult. With networks experiencing bandwidth issues, it may  become time-consuming to view even though they are cool and fun way of representation.

Explore more with us
 
Bliss Web Solution Pvt. Ltd. is a top-notch web development company specializing in optimization of CSS code for high traffic websites. To delve deeper into technicality, you can freely attend weekend discussions held at our office in Ahmedabad, just drop an e-mail to us at enquiry@blisswebsolution.com

JavaScript: The most emerging technology in the software industry


Javascript is declared as number one programming language of the world in the year of 2014 by TIBOE index which summarizes on the basis of number of lines of code collected in Git repository. Since then, the language has shown drastic growth in its uses for various verticals apart from internet and web.   

Last month i.e. Nov-Dec 2016, while in an interview,  Brendan Eich, creator of the software revealed that Javascript is now-a-days used even for machine learning purpose. Following excerpts from interview he also told that new component namely WebAssembly is already derived from asm.js that can be used and optimized so that cross-platform products can be written in purely Javascript with equivalent to native speed support with Google’s Portable Native Client ( PnaCI ) and it will go live in first quarter of 2017.  All the top 10 most popular websites of the world unflinchingly consume Javascript code fragments as client side software alike server side programming languages in whichcase  no single software dominates. 

Right from the start, JavaScript is shaping rich development ecosystem that language enjoys today. Software developers can use JavaScript for almost all sorts of things.
It is now possible to run real time games in browsers without plugins by methods of two powerful JS libraries: asm.js and WebGL.  With ECMAScript 6, JavaScript is packed up with a ton of new features targeted towards making life easier for people building transpilers, i.e. programming languages that compile down to JavaScript, like Uberscript, CoffeeScript, C++ etc.  

Keeping pace with multi-core CPUs speed, JavaScript allows programmers to use monads of functional programming constructs and they use it without knowing it.  Functional reactive library Bacon.js posses good stars on GitHub. 

The positive side of Javascript is that it was designed to be agnostic about coder’s programming style and paradigm and perhaps therefore so many libraries related to it exists today serving diversified purposes, to give few names, D3.js, Node.js, Async, Angular.js, ExtJS, Google maps JavaScript APIs etc.  In the Javascript world, if one is well-grounded developer then it is a matter of seconds to adopt design patterns and techniques of a new framework a programmer is not normally accustomed to and can build an extension or module. Alike previous decade, we can build mobile web application entirely written in JavaScript  using Node.js, JQuery, MongoDB and Phonegap.

Io.js is a famous fork of Node.js created with the intention of community control over the future of Node.js environment compatibilities and posses far more ECMAScript6 features than its base.  Although less commonly known at the moment,  there are also people using JavaScript to do embedded programming. They use it to communicate directly with the outside world by using MicroControllers and other electronics related utilities.

The platform is ubiquitous. Trainers of GIS solutions insist on combining JavaScript with Python to generate full-blown feature rich map servers.   Upcoming elegant JavaScript features include generators, promises to give us better control over asynchronous code, proxies, regular expression enhancements and advanced array methods, which make array-handling code courteous.

Honing  skills to tie new concepts and features together gives a programmer a level of understanding that puts one in the elite group.

And traditional uses of JavaScript are continued i.e. use in browsers to impart functionality into a website and executing generous work of loading login forms, fancy animations etc. Elaborately endorsed by all categories of software experts,  jQuery is becoming the most popular among developers since it makes it easier to use JavaScript, specially with readymade code recipes. 

JavaScript code snippets are used to create animations and games as well.  There are frameworks that help you to explore even 60+ frames per second.  You can find animations where you can virtually move the camera and view the sequence from position of your preference with JS. If anything left, they are desktop software.  Oppose to its original purpose i.e. web development, the technology is expanded by passionate technology specialists to apply it to this arena with help of variants like Nashorn, a JavaScript engine developed by Oracle to run and execute on JVM.  Lot of embedded devices including the Tessel use JS as part of software system. 

To summarize, even though Javascript is not stand alone computer language, there is no alternative and competitor of this software. Regardless of our opinion for JavaScript, not to know it would be hazardous to any programmer’s career.  Future of JavaScript developer is bright and high-paying, for technology will not only be maintained, but will be extended in its hold by software industry experts to reach new heights during the coming years.

Bliss Web Solution Pvt. Ltd. is an experienced and well-established company specializing in website design and development. We have planned, created and launched numerous prestigious websites for various businesses sprawled across the globe. With our team's combined excellence and years of experience in graphic designing, website development, e-commerce programming and Flash animation, you can be certain whatever is the requirement of your project; our professionals will deliver it in stipulated timeframe and in pre-set budget. No matter, whether you need a small business website, a newsletter, flash banner, online brochure, e catalogues or animations for internet marketing activities, we will be able to design anything your online business demands.

For any further discussion, please drop an e-mail to enquiry@blisswebsolution.com.