I have a jquery ajax carousel and I am trying to edit the path, but what ever I do with it, it's not changing up. Can any one please help me out with this.
Here is the jquery code
$(document).ready(function () {
var dir = "../images/big-carousel/";
var first = true;
var className = 'class="item active"';
var fileextension = ".jpg";
$.ajax({
url: dir,
success: function (data) {
$(data).find("a:contains(" + fileextension + ")").each(function () {
if (first == false) {
className = 'class="item"';
}
var filename = this.href.replace(window.location.host, "").replace("http:///tabs/", "");
$("#bigCarousel .carousel-inner").append($("<div " + className + " style=\"background-image:url(" + filename + dir + ")\"></div>"));
first = true;
});
}
HTML Code
<div id="background-carousel">
<div id="bigCarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner" >
</div>
</div>
</div>
请尝试以下代码:
$("#bigCarousel .carousel-inner").append($("<div " + className + " style=\"background-image:url(" + dir + filename + ")\"></div>"));
try to replace you last line jquery code with following :-
$("#bigCarousel .carousel-inner").append($("<div " + className + " style=\"background-image:url('" + filename + dir + "')\"></div>"));
It may help you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.