gausie Posted July 13, 2007 Share Posted July 13, 2007 If I'm updating the innerHTML of a div from an AJAX call, how can I make the new content fade in rather than just appear? And I need to do this so that it is cross-browser compatable gausie Link to comment https://forums.phpfreaks.com/topic/59809-would-like-new-content-to-fade-in-on-an-ajax-call/ Share on other sites More sharing options...
nogray Posted July 13, 2007 Share Posted July 13, 2007 If you check the NoGray JavaScript library, you'll find a whole set of animation options. Also there is a set opacity function. Or you can do use the set opacity as a stand alone with a setTimeout to hide and show the divs. // pass the object to the function using // something like document.getElementById() // IE might need the object to have absolut positioning function setOpacity(obj, val){ // checking if the browser is Opera var is_Opera = (window.navigator.userAgent.search("Opera") != -1); // checking if the browser is IE var is_IE = ((window.navigator.userAgent.search("MSIE") != -1) && !is_Opera); if (is_IE){ obj.style.filter ="progid:DXImageTransform.Microsoft.BasicImage(Opacity="+val+")"; } else { obj.style.MozOpacity = val; } obj.style.opacity = val; } The val should be between 0 to 1 Link to comment https://forums.phpfreaks.com/topic/59809-would-like-new-content-to-fade-in-on-an-ajax-call/#findComment-297479 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.