herghost Posted March 10, 2010 Share Posted March 10, 2010 Hi all, I want to display some blocks of text (testimonials) on my website, however I want them to auto fade in/out every 3 seconds or so without refreshing the page, is this possible with ajax? Where would I start? I know I could do it in PHP by assigning each testominial to an array, then using the rand() function to display one, however the user would have to refresh the page everytime to view a new one Link to comment https://forums.phpfreaks.com/topic/194760-ajax-basics-help/ Share on other sites More sharing options...
trq Posted March 10, 2010 Share Posted March 10, 2010 Ajax is used to make http request back to a server via Javascript. You may or may not need to use it to retrieve your testimonials. What I would do would be to have php load all your testimonials into a Javascript array when the page is created and then simply use Javascript to display these one after the other as you describe. How many testimonials do you expect to display? Link to comment https://forums.phpfreaks.com/topic/194760-ajax-basics-help/#findComment-1024162 Share on other sites More sharing options...
herghost Posted March 10, 2010 Author Share Posted March 10, 2010 Hi Thorpe, Thanks for your reply, only 3 or 4 at the moment, but possibly upto 20. Thanks Link to comment https://forums.phpfreaks.com/topic/194760-ajax-basics-help/#findComment-1024166 Share on other sites More sharing options...
trq Posted March 10, 2010 Share Posted March 10, 2010 Yeah, I would still think it best not to bother with any Ajax and just load them into a Javascript array and go from there. Do you know any Javascript at all? Link to comment https://forums.phpfreaks.com/topic/194760-ajax-basics-help/#findComment-1024168 Share on other sites More sharing options...
herghost Posted March 10, 2010 Author Share Posted March 10, 2010 Hi Thorpe, Thanks, yes, well enough to give this ago, and I will never learn properly unless I try! Cheers Link to comment https://forums.phpfreaks.com/topic/194760-ajax-basics-help/#findComment-1024180 Share on other sites More sharing options...
gamblor01 Posted March 10, 2010 Share Posted March 10, 2010 herghost, I'm not sure if this is precisely what you are looking for, but I saw a web page for a local restaurant that uses CSS to scroll pictures and text. It doesn't fade in and out, but scrolls off the screen to display the next picture/text comment. You might be interested -- if you view the page source you'll see the style sheets and looking at those will show you how to scroll: http://www.yanagitx.com/ thorpe's idea sounds like a good one to. So maybe if you can load them all into an array, you can use CSS to scroll through them. If you have a tutorial on how to fade text in and out I would be interested to see that too! Link to comment https://forums.phpfreaks.com/topic/194760-ajax-basics-help/#findComment-1024391 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.