Loader ajax/css
- Started
- Last post
- 4 Responses
- quamb
Is there a way to have a loader gif or div appear whenever an image or content loads into a page? In particular, the images called into a div via js (function movepic).
Having a loader simply as a background image won't work in this case.
Am terrible at js and have been searching but no luck...
- erikjonsson0
must be some kind of best of ajax gallery out there. just popping ajax loader into wordpress plugin search gives a ton of usefull stuff.
my alltime favo is probablty the infinite scroller that took away the pain of pressing next when browsing image feeds
- neverblink0
in your JS function:
1. set loader img to display:visible
2. do AJAX call
3. when call is done display image as background image
4. set loader img to display:noneUnfortunatly img.onload doesn't work well across different browsers
- quamb0
I've managed to get this far... though can't figure out how to make display=none once the img has loaded. Am guessing this code is horribly wrong...
function movepic(img_name,img_src) {
var loadingdiv = document.getElementById('loading...
loadingdiv.style.display = "block";document[img_name].src=img_src;
var loadingdiv = document.getElementById('loading...
loadingdiv.style.display = "none";
}
- neverblink0
you need to hide the loader image when the Ajax call was completed