Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

JavaScript Carousel help needed

Posted on 2016-08-15
7
Medium Priority
?
55 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 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
Cloud Training Guides

FREE GUIDES: In-depth and hand-crafted Linux, AWS, OpenStack, DevOps, Azure, and Cloud training guides created by Linux Academy instructors and the community.

 
LVL 58

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 58

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 58

Expert Comment

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

Featured Post

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

730 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