此页面为源码效果演示页面,您可以选择


返回易站站长网首页|返回此源码目录-下载此源码

Dynamic content via JSON

Setup

With this setup, all content is coming from external file data.json. To get this stuff working prepare JSON file with proper structure (see JSON below).

{
  "owl" : [
      {"item" : "your html content..."},
      {"item" : "your html content..."},
      ...
  ]
}
            
$(document).ready(function() {

  $("#owl-demo").owlCarousel({
    jsonPath : "json/data.json" 
  });

});
<div id="owl-demo" class="owl-carousel owl-theme">
</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;
}

{
  "owl" : [
      {"item" : "<span class='item'><h1>1</h1></span>"},
      {"item" : "<span class='item'><h1>2</h1></span>"},
      {"item" : "<span class='item'><h1>3</h1></span>"},
      {"item" : "<span class='item'><h1>4</h1></span>"},
      {"item" : "<span class='item'><h1>5</h1></span>"},
      {"item" : "<span class='item'><h1>6</h1></span>"},
      {"item" : "<span class='item'><h1>7</h1></span>"},
      {"item" : "<span class='item'><h1>8</h1></span>"},
      {"item" : "<span class='item'><h1>9</h1></span>"},
      {"item" : "<span class='item'><h1>10</h1></span>"},
      {"item" : "<span class='item'><h1>11</h1></span>"},
      {"item" : "<span class='item'><h1>12</h1></span>"},
      {"item" : "<span class='item'><h1>13</h1></span>"},
      {"item" : "<span class='item'><h1>14</h1></span>"}
  ]
}

More Demos