09
2011Text Slider for Testimonials with Navigation – JavaScript Widget using jQuery Cycle Plugin
Tags: javascript | jQuery
The jQuery Cycle Plugin is a slideshow plugin that supports many different types of transition effects. jQuery-Cycle plugin can be used to create a simple text slider to show testimonials on web page. There are many options that you can use to control how and when your slide transitions occur. You can also add the navigation links to go through your testimonials.
Here’s the demo of Testimonials Slider using jQuery library and Cycle Plugin:
You can view jQuery Cycle Testimonial Slider Demo in a new window here.
Let’s start adding the code on your web page in three easy steps.
First of all, add jQuery library and Cycle plugin that’s required for this slider. Add folowing code in the head section of yuor web page.
<!-- include jQuery library --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <!-- include Cycle plugin --> <script type="text/javascript" src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.latest.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#testimonials') .before('<div id="nav">') .cycle({ fx: 'fade', // choose your transition type, ex: fade, scrollUp, scrollRight, shuffle pager: '#nav' }); }); </script>
As a second step, add these styles to your .css file or just add in the web page using style tag:
#testimonials { width:330px; background:#E7E9E6 url(images/bg-testimonials.png) left top repeat-x; border:1px solid #D8D9D6; margin:10px 0; } #testimonials blockquote{ padding:10px; width:300px !important; font-family:Georgia, "Times New Roman", Times, serif; font-style:italic; color:#808080; display:block; } #testimonials blockquote p{ margin: 0 !important;padding: 5px!important; } #testimonials blockquote cite { font-style: normal; display: block; text-transform: uppercase; font-weight: bold; font-style:italic; color: #555; padding-left:5px; margin-top:10px; }
In the last step, add this html code to your webpage where you want to show the testimonials:
<h1>Testimonials</h1>
<div id="testimonials">
<blockquote><p>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. "
<cite>–Martin - NY</cite></p></blockquote>
<blockquote><p>"Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
<cite>–Sandra - LA</cite></p></blockquote>
<blockquote><p>"Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
<cite>–Jason - MA</cite></p></blockquote>
</div><!--end testimonials-->You may need to change the width of the testimonials box as per your requirements. You can also define the styles for the navigation links using the #nav in your css file.
Hope that helps.
Cheers!
Related posts:
- jQuery Testimonials Slider with Navigation and Effects using Cycle Plugin – Multiple Sliders on Same Page
- Nivo Slider as Image Slider Add-on for osCommerce Store
- Resolve Jquery Mobile Framework Zoomed Out Text and Font Size Problem on iPhone
- Adding rel Attribute to All Links for jQuery Mobile App Page Using jQuery
- PIM osCommerce Slider
archie
hey,
i m web developer
thanks a lot for this fabulous script
its very simple easy
Brian
Awesome, thank you so much for this… was looking for this all over !
Lee
Brilliant thanks!! What do I need to do to be able to use this multiple times on the same page?
Ali Qureshi
Hi Lee,
You can check this post for Multiple Testimonials Sliders on one page.
Lee
Thanks Ali, thats perfect. Such a simple and light solution.
Lee
One question, how can I control the time duration that each testimonial is displayed for.
Ali Qureshi
Just add the timeout like this:
1000 means 1 second.
Stan
Thanks! Looked forever for something like this. Couple questions: how do I set the navigation either above or below the text, and how do I separate the css underlines for 1-2-3, etc. ?
Thanks again.
Ali Qureshi
check this post for Multiple Testimonials Sliders on single page for navigation styles. This page also has example of before and after navigation.
BTW, following code adds the nav:
khan
I would like to add about 50 testimonials, and dont need the navigation. Is it possible? If so, how?
Thanks
Ali Qureshi
You can add as many testimonials as you want, just remove .before(‘‘)
to remove navigation.
Miki
Hi Ali
I added to http://www.kidforever.com/ but the slider is going too fast. I added the timeout and what it does is to make the slider not work.
Let me know
Ali Qureshi
Set the speed like this:
Aaron
How do you make it display quotes randomly?
Ali Qureshi
To show them randomly, it would be best and easiest to do in PHP. Place all the testimonials in the php array and then shuffle the array elements and then list them like this:
James
What would be the best way to manipulate the content of the navigation (i.e instead of 1, 2, 3, one two three) Also, is it possible for the slider to pause on mouse-over?
Ali Qureshi
Try this, this will replace numbers with a circle:
JP
thanks, works great,
how can i set the background transparent. ?
ex.
#testimonials blockquote
{
background-color:transparent;
……..
…………
}
but this dont work in IE
Ali Qureshi
You can simply remove background-color style.
manos
Amazing script. is there any possibility to hide the navigation?
Ali Qureshi
Just remove pager and nav, use it like this:
Guillermo Lopez
hi, could you please tell me I need to do to fit automatically at the height of the testimonial
Ali Qureshi
It automatically does that already. There’s no need to define height for anything.
John
Great tutorial. Going to change the css up a little but this was just what i was looking for. Hopefully this works in IE, cant check since im on mac right now. But in case it doesnt work in IE, is there a quick fix?
Thanks for the slider again!
Ali Qureshi
Don’t worry, it works in IE, even in IE6.
John
GREAT, I am putting my own css spin on it now. Thanks again
S
Hi, I’m not good with this stuff at all. How do I download the library and cycle plugins?
Ali Qureshi
You don;t have to download these two libraries. just include in your web page like this:
S
That’s what I did but the slider looks like this on my page:
http://www.savannalikeswords.com/
Ali Qureshi
Your WordPress theme has included jQuery already. You just need to include the following code:
S
Any help, anyone?
Ali Qureshi
Please see this page http://www.parorrey.com/wp-content/uploads/2011/10/testimonials-demo.html and view its source code. That;s all you need to put in your page.
S
Okay, I literally copied and pasted everything on that page and it still didn’t work. I’m wondering if it’s something with my theme…
Ali Qureshi
Your theme already has jQuery file included. Don’t include it again and try with that.
S
Yes, I did that and it still didn’t work. I’ve noticed that tags don’t seem to function correctly whenever I use them on my site. I’m thinking it must be something with my theme. Checking with my web developer.
Orwell
Looks very nice. How can we make it to stop if “mouseover” ?
Ali Qureshi
Following code will pause and resume on mouseover and mouseout events respectively:
Just add these lines in the above example after $(document).ready(function() {.
Srichitra
I have a doubt. It might be a stupid one.
“How do you make it work in Drupal? I tried drupal_add_js, still its not working”.
Please help.
macaulus
nice and easy install, everything worked perfectly, wonderful, painless, simple, thanks a great deal, you rock
Alex
Really nice script! Works perfect, I only have one question considering the CSS. How can we place the navigation buttons and the div in the center of the page?
Ali Qureshi
Assuming your navigation div id #nav, following css code should do:
Mark Wasyl
Exactly what I was looking for… and super easy to install and use! My next challenge will be to integrate this into WordPress.
Thank you Ali for taking the time to put this tutorial together!
hj
nevermind, sorry, it does work in IE like you said. i was trying to tweak it and remove the blockquote & P tags.
helps to set the blockquote div to margin: 0px; …
Ali Qureshi
Yes, It works in all IR versions.