close this ads
Today, Mata Brahmacharinid - माता ब्रह्मचारिणी worshiped during Shardiya Navratri 2017.

Difference between $(document).ready and $(window).load in jQuery

$(document).ready(function(){
//code here
});
The code above is used almost every time when we work with jQuery. Also other variations like $(function(){ //code here }) and some more. This code is used when we want to initialize our jQuery codes after the DOM is ready. document.ready is a jQuery event, it runs when the DOM is ready, e.g. all elements are there to be found/used, but not necessarily all content.
------------------------------
Question? do we need $(window).load() for?

Sometimes you want to manipulate pictures. For example you want to verticaly and horizontaly align a picture and you need to get the width and height of the picture in order to do that. With $(document).ready() you won’t be able to do that if the visitor doesn`t have the image already loaded, in which case you need to initialize the jquery alignment function when the image finishes loading. That`s where we use…

$(window).load(function(){
//initialize after images are loaded
});
window.onload fires later(or at the same time in the worst/failing cases) when images and such are loaded, so if you`re using image dimensions for example, you often want to use this instead.
- Nitin Pratap Singh
If you love this article please like, share or comment!
XOR and XNOR Implementation using JavaScript
Conceptual representation of XOR using Truth Table, Conceptual representation of XNOR using Truth Table and javascript representation.
Net Neutrality
The principle that Internet service providers should enable access to all content and applications regardless of the source, and without favouring or blocking particular products or websites.
Easy way to handle dynamic Bind Params in Prepared Statements using MySQLi
* Return: Database ResultSet * $arrType: Array type - data-type against inputs `$arrParam` * $arrParam: Array Type - List of all bind values.
The Brand Life Cycle #LearnFromLife
A brand should be grownup like a child,
When It become young, should be responsible for nature...
Difference between $(document).ready and $(window).load in jQuery
A good description of both cases with appropriate example of $(document).ready(function(){}) and $(window).load(function(){})
Data analysis using two semi circle donut in Highcharts
Create a outer container `div`, do not include any text under container div. Define `position:relative`.
Bind the custom function with twitter event
Loading the widgets.js file asynchronously will require you to wait before binding events. You will need to wrap your event bindings in a callback function which will be invoked once everything has loaded.
Highlight: What`s new in PHP 7
PHP 7 is up to twice as fast as PHP 5.6, Consistent 64-bit support, Many fatal errors are now Exceptions...
Basic Git commands to push / pull repository
Push code to git | Get the latest code first time | Get the latest code and reset the current code | no conflicts with new-online version...
Sensitivity of Digital Data
In the world of computer, tab and mobile; how to use these gadget is important concern. Some of instance experienced in our day to day life, these can’t be ignore...
JhandewalanJhandewalan
By the inspiration of spiritual power Shri Badri Bhagat initiate a Mata temple on hill and also install a flag therefore called Jandewala Temple but actual name of the temple is झंडेवालान (Jhandewalan), near Jhandewalan metro station.
मसखरी - Maskhari
उड़ते उड़ते ख़बर आयी है कि विश्व के सभी देशों की यात्रा निपटाने के बाद मोदी जी चाँद पर भी जाएँगे l
Bachpan to Reebok
पढ़-लिख कर हमने कार खरीदी :(
और वो...
अनपढ़ रह कर भी पेड़ लगाने चल दिए!!
Kavi Vinod Pandey Ki Kalam - 2017
खा रहें हैं जो टमाटर आजकल,दायरे में टैक्स के वो आएँगे
पी रहे हैं जो टमाटर जूस उनके, घर पे छापे जल्द मारे जायेंगे...
घुरपेँच - Ghurpainch
Q: ऑफ़स मे आपका ईशान कोण किस दिशा मे है?
A: जिस दिशा मे आपके बॉस की सीट हो, वही आपकी उत्तम दिशा है ;)
दिल्ली एन.सी.आर. में भारी वर्षा
दिल्ली मे बारिश हुई नही और टीवी, इंटरनेट, मोबाइल और रोड नेटवर्क सब जाम से जाम छलकाते मिलेंगे :)
ज्ञान मुद्रा
भारतीय संस्कृति में सबसे ज्यादा ज्ञान मुद्रा को प्राथमिकता दी जाती है। जिस कारण ही हमारे पूर्वज और ऋषिओं को सर्वज्ञ ज्ञान था।...
कौन सी धातु के बर्तन में भोजन करने से क्या लाभ और हानि?
कौन सी धातु के बर्तन में भोजन करने से क्या क्या लाभ और हानि होती है
सोना एक गर्म धातु है।...
सेल्फी लेना हो सकता है आपके लिए खतरनाक!!
Caused by overusing the muscles attached to your elbow and wrist. Taking too many photos of yourself can result in selfie elbow, latest injury related to tech equipment...
Yoga is India`s Gift to the World
Sadhguru speaks at the United Nations General Assembly on International Day of Yoga 2016, about yoga being India's gift to the world, and how it is a science of inner wellbeing.
प्राण मुद्रा
बचपन से ही चश्मा का लगना, प्राणशक्ति को बढ़ाना और शारीर को निरोग रखना प्राण मुद्रा इसके लिए रामवाण का कम करती है..
स्वच्छ भारत अभियान - Swachh Bharat Abhiyan
^
top