Solved

JavaScript Carousel help needed

Posted on 2016-08-15
7
42 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
[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
  • 3
  • 3
7 Comments
 
LVL 8

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 8

Expert Comment

by:Mukesh Yadav
ID: 41756305
What Carousel are you trying to implement?
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 56

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 56

Accepted Solution

by:
Julian Hansen earned 500 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 8

Expert Comment

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

Expert Comment

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

Featured Post

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!

Question has a verified solution.

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

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
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)

696 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