?
Solved

Add Javascript to Cause JQuery Slideshow to Start at Random

Posted on 2014-04-16
4
Medium Priority
?
784 Views
Last Modified: 2014-04-18
I am working on the following site:

http://domgarofalo.com/wellcity/

Under the section 'WHAT LEADERSHIP IS SAYING'
the pictures advance in alphabetical order. I would like
to modify the script so they start in random order each
time the page is loaded.

The script is located between lines 556-586.

Would I do this as an array?
0
Comment
Question by:domgarofalo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
Jeffrey Dake earned 2000 total points
ID: 40005756
Looking at the docs of the library you are using you should be able to just start = random and the javascript library should already be able to pick a random picture to start with.

<script type="text/javascript">
$(window).load(function(){			
			$('#recent-projects').carouFredSel({
                                start: random,
				responsive: true,
				width: '100%',
				auto: true,
				circular	: true,
				infinite	: false,
				prev : {
					button		: "#car_prev",
					key			: "left",
						},
				next : {
					button		: "#car_next",
					key			: "right",
							},
				swipe: {
					onMouse: true,
					onTouch: true
					},
				scroll : 1500,
				items: {
					visible: {
						min: 1,
						max: 1
					}
				}
			});
		});	
</script>

Open in new window


http://docs.dev7studios.com/jquery-plugins/caroufredsel-advanced

Hope that helps
0
 

Author Comment

by:domgarofalo
ID: 40006929
Unfortunately it did not. It lists all the profiles vertically instead with no scrolling. Any other ideas?
0
 

Author Comment

by:domgarofalo
ID: 40006979
When added random here,

items: {
                              start: 'random',
                              visible: {
                                    min: 1,

it did the trick. Thanks for the help.
0
 
LVL 10

Expert Comment

by:Jeffrey Dake
ID: 40009995
Sorry I put it in the wrong spot. Glad it helped you out
0

Featured Post

Tutorial: Introduction to Managing a Linux Server

In this tutorial on systemd, we will explore:
-OS/Distro Adoption
-chkconfig and Other Legacy Commands
-Summary and Key Commands

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question