0
I’m having trouble making jquery work. Here’s the head
of my HTML:
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link rel="script" type="text/javascript" href="script.js">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="style.css">
And here’s my javascript:
$(document).ready(function() {
var currentPosition = 0;
var slideWidth = 580;
var slides = $(".movie");
var numberOfSlides = slides.length;
var slideShowInterval;
var slideshowSpeed = 3000;
slideShowInterval = setInterval(changePosition, slideshowSpeed);
slides.wrapAll("<div id="slidesHolder"></div>");
slides.css({"float": "left"});
$("#slidesHolder").css("width", slideWidth * numberOfSlides);
function changePosition() {
if (currentPosition == numberOfSlides) {
currentPosition = 1;
}
else {
currentPosition += 1;
}
moveSlide();
}
function moveSlide() {
$("#slideHolder").animate({"marginLeft": slideWidth * (-currentPosition)});
}
});
The strange thing is that I’ve used Jquery in exactly the same way on other sites before, and it worked perfectly. I’ve done the test of alert
, I tried to use the downloaded library instead of Google CDN, I tried to change the order of <script>
in head
HTML, and I’ve searched for the same problem on other forums, but unsuccessfully getting help.
Thanks for the warning, but jquery is still not working. I took the Alert() test; and nothing happens.
– Lele
Make F12 and see the error that is on the console
– CesarMiguel
Your answer is here: http://jsfiddle.net/ivanferrer/fdgnnhz1/1/
– Ivan Ferrer