Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

JavaScript Carousel help needed

Posted on 2016-08-15
7
Medium Priority
?
56 Views
Last Modified: 2016-09-03
I am trying to build a carousel into an existing web page (prototype only). I found a lot of code - the sample I used is below:

<!DOCTYPE html SYSTEM "about:legacy-compat">
<html lang="EN">
<head>
<title>Carousel</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="imagetoolbar" content="no" />
<link rel="stylesheet" href="styles/layout.css" type="text/css" />
<script src="lib/js/jquery-1.8.3.min.js"></script>
<script src="lib/js/bootstrap.min.js"></script>
</head>
<body>
		
	
	
	<div id="myCarousel" class="carousel slide" data-ride="carousel">
		<!-- Indicators -->
		<ol class="carousel-indicators">
			<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
			<li data-target="#myCarousel" data-slide-to="1"></li>

		</ol>
		<!-- Wrapper for slides -->
		<div class="carousel-inner" role="listbox">
			<div class="item active">
				<img src="images/image1.jpg" alt="Chania">
			</div>

			<div class="item">
				<img src="images/image2.png" alt="Chania">
			</div>

			<a class="left carousel-control" href="#myCarousel" role="button"
				data-slide="prev"> <span
				class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
				<span class="sr-only">Previous</span>
			</a> <a class="right carousel-control" href="#myCarousel" role="button"
				data-slide="next"> <span
				class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
				<span class="sr-only">Next</span>
			</a>

		</div>
	</div>
	
	
</body>
</html>

Open in new window


However, the carousel doesn't show up as I expect on the browser -

What the webpage looks like
Any idea what could be wrong?
0
Comment
Question by:mightyestme
  • 3
  • 3
7 Comments
 
LVL 9

Expert Comment

by:Mukesh Yadav
ID: 41756214
Hi mightyestme,

Where you added code to implement Carousel?

Thanks,
Mukesh Yadav
0
 

Author Comment

by:mightyestme
ID: 41756269
Hi. Its under lib/js/
0
 
LVL 9

Expert Comment

by:Mukesh Yadav
ID: 41756305
What Carousel are you trying to implement?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 60

Expert Comment

by:Julian Hansen
ID: 41756330
First up I don't see where you are including the Bootstrap CSS file

Try adding this to your code

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />

Open in new window

0
 
LVL 60

Accepted Solution

by:
Julian Hansen earned 2000 total points (awarded by participants)
ID: 41756339
This seems to work
<!DOCTYPE html SYSTEM "about:legacy-compat">
<html lang="EN">
<head>
<title>Carousel</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="imagetoolbar" content="no" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="styles/layout.css" type="text/css" />
<script src="http://code.jquery.com/jquery.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
    
  
  
  <div id="myCarousel" class="carousel slide" data-ride="carousel">
    <!-- Indicators -->
    <ol class="carousel-indicators">
      <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
      <li data-target="#myCarousel" data-slide-to="1"></li>

    </ol>
    <!-- Wrapper for slides -->
    <div class="carousel-inner" role="listbox">
      <div class="item active">
        <img src="images/image1.png" alt="Chania">
      </div>

      <div class="item">
        <img src="images/image2.png" alt="Chania">
      </div>

      <a class="left carousel-control" href="#myCarousel" role="button"
        data-slide="prev"> <span
        class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
        <span class="sr-only">Previous</span>
      </a> <a class="right carousel-control" href="#myCarousel" role="button"
        data-slide="next"> <span
        class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
        <span class="sr-only">Next</span>
      </a>

    </div>
  </div>
  
  
</body>
</html>

Open in new window


Working sample here
1
 
LVL 9

Expert Comment

by:Mukesh Yadav
ID: 41782774
Answer with working example. :)
0
 
LVL 60

Expert Comment

by:Julian Hansen
ID: 41782799
You are welcome.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The viewer will learn how to count occurrences of each item in an array.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

916 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