How to create a JavaScript callback for knowing when an image is loaded?

.complete + callback This is a standards compliant method without extra dependencies, and waits no longer than necessary: var img = document.querySelector(‘img’) function loaded() { alert(‘loaded’) } if (img.complete) { loaded() } else { img.addEventListener(‘load’, loaded) img.addEventListener(‘error’, function() { alert(‘error’) }) } Source: http://www.html5rocks.com/en/tutorials/es6/promises/

How to add a spinner icon to button when it’s in the Loading state?

Simple solution for Bootstrap 3 using CSS3 animations. Put the following in your CSS: .glyphicon.spinning { animation: spin 1s infinite linear; -webkit-animation: spin2 1s infinite linear; } @keyframes spin { from { transform: scale(1) rotate(0deg); } to { transform: scale(1) rotate(360deg); } } @-webkit-keyframes spin2 { from { -webkit-transform: rotate(0deg); } to { -webkit-transform: rotate(360deg); … Read more

Using the “animated circle” in an ImageView while loading stuff

Simply put this block of xml in your activity layout file: <RelativeLayout android:id=”@+id/loadingPanel” android:layout_width=”match_parent” android:layout_height=”match_parent” android:gravity=”center” > <ProgressBar android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:indeterminate=”true” /> </RelativeLayout> And when you finish loading, call this one line: findViewById(R.id.loadingPanel).setVisibility(View.GONE); The result (and it spins too):

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)