javascript - Extracting images to flexslider -
i'm using image slider known flexslider. i'm adding images manually, want enhance images can extracted specific folder , added <li>
elements. i'm looking jquery function so. possible?
jsfiddle: http://jsfiddle.net/t3sgbq5w/
html:
<div class="flexslider"> <ul class="slides"> <li> <img src="http://placehold.it/350x150" /> </li> <li> <img src="http://placehold.it/350x150" /> </li> <li> <img src="http://placehold.it/350x150" /> </li> </ul> </div>
no. javascript client-side technology , cannot on server. use ajax call server-side script (e.g. php) return information need. think need php or asp this, here code in php:
<div class="flexslider"> <ul class="slides"> <?php $folder = 'images/galerija'; // chose folder $extensions = array('jpg','jpg','jpeg','gif','png'); // allowed extensions $slika = scandir($folder); // scan folder sort($slika); // sort foreach($slika $key => $value) { $get_extensions = explode(".",$value); $ext = $get_extensions[count($get_extensions) - 1]; if (in_array($ext, $extensions)) { $title = substr($value, 0,strrpos($value,'.')); // image name echo "<li><img src='".$folder."/".$value."' /></li>"; } } ?> </ul> </div>
and this:
<div class="flexslider"> <ul class="slides"> <li><img src="images/image.jpg" /></li> <li><img src="images/image2.jpg" /></li> <li><img src="images/image3.jpg" /></li> </ul> </div>
Comments
Post a Comment