/var/www/clients/client1/web2/web/latynplast/js/owl.carousel/demos
NameSizeModeActions
assets/-0755rm
json/-0755rm
autoHeight.html126640644editdlrm
click.html134220644editdlrm
custom.html148560644editdlrm
customJson.html117480644editdlrm
full.html116630644editdlrm
images.html119280644editdlrm
itemsCustom.html138850644editdlrm
json.html121780644editdlrm
lazyLoad.html143050644editdlrm
manipulations.html159510644editdlrm
navOnTop.html137400644editdlrm
navOnTop2.html119070644editdlrm
one.html113750644editdlrm
owlStatus.html157920644editdlrm
progressBar.html148650644editdlrm
randomOrder.html145830644editdlrm
scaleup.html117760644editdlrm
sync.html201010644editdlrm
transitions.html130160644editdlrm
Edit: /var/www/clients/client1/web2/web/latynplast/js/owl.carousel/demos/customJson.html (11748B)
Owl Carousel - Dynamic content via custom JSON

Dynamic content via custom JSON

Setup

This example uses custom structure of JSON file customData.json.

$(document).ready(function() {

  $("#owl-demo").owlCarousel({
    jsonPath : 'json/customData.json',
    jsonSuccess : customDataSuccess
  });

  function customDataSuccess(data){
    var content = "";
    for(var i in data["items"]){
       
       var img = data["items"][i].img;
       var alt = data["items"][i].alt;

       content += "<img src=\"" +img+ "\" alt=\"" +alt+ "\">"
    }
    $("#owl-demo").html(content);
  }

});
<div id="owl-demo" class="owl-carousel">
</div>
#owl-demo .item{
  background: #a1def8;
  padding: 30px 0px;
  display: block;
  margin: 5px;
  color: #FFF;
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  border-radius: 3px;
  text-align: center;
}

{
  "items" : [
    {
      "img": "assets/owl1.jpg",
      "alt" : "Owl Image 1"
    },
    {
      "img": "assets/owl2.jpg",
      "alt" : "Owl Image 2"
    },
    {
      "img": "assets/owl3.jpg",
      "alt" : "Owl Image 1"
    },
    {
      "img": "assets/owl4.jpg",
      "alt" : "Owl Image 2"
    },
    {
      "img": "assets/owl5.jpg",
      "alt" : "Owl Image 1"
    },
    {
      "img": "assets/owl6.jpg",
      "alt" : "Owl Image 2"
    }
  ]
}