jCarousel et Thickbox 3

jCarousel et Thickbox 3 - HTML/CSS - Programmation

Marsh Posté le 08-01-2010 à 16:50:21    

Bonjour,
j'aimerai modifier ce code afin d'afficher les photos de ma base de donnée dans mon carousel mais je ne vois pas comment faire pouvez vous m'aider.Il faudrait charger $row[1] dans mycarousel_itemList.  
 

Code :
  1. <?php
  2. echo '<?xml version="1.0" encoding="UTF-8"?>
  3.             <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  4. "http://www.w3.org/TR/xhtml1-strict.dtd">
  5.        <html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr">
  6.        <head>
  7.        <script src="script/script.js" type="text/javascript" ></script>
  8.        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  9.        <link rel="stylesheet" type="text/css" media="screen"href="style.css" />
  10. <script type="text/javascript" src="lib/jquery-1.2.3.pack.js"></script>
  11. <script type="text/javascript" src="lib/jquery.jcarousel.pack.js"></script>
  12. <script type="text/javascript" src="lib/thickbox/thickbox.js"></script>
  13. <link rel="stylesheet" type="text/css" href="lib/jquery.jcarousel.css" />
  14. <link rel="stylesheet" type="text/css" href="lib/thickbox/thickbox.css" />
  15. <link rel="stylesheet" type="text/css" href="skins/ie7/skin.css" />
  16. <script type="text/javascript">
  17. // Set thickbox loading image
  18. tb_pathToImage = "images/loading-thickbox.gif";
  19. var mycarousel_itemList = [
  20.     {url: "http://static.flickr.com/66/199481236_dc98b5abb3_s.jpg", title: "Flower1"},
  21.     {url: "http://static.flickr.com/75/199481072_b4a0d09597_s.jpg", title: "Flower2"},
  22.     {url: "http://static.flickr.com/57/199481087_33ae73a8de_s.jpg", title: "Flower3"},
  23.     {url: "http://static.flickr.com/77/199481108_4359e6b971_s.jpg", title: "Flower4"},
  24.     {url: "http://static.flickr.com/58/199481143_3c148d9dd3_s.jpg", title: "Flower5"},
  25.     {url: "http://static.flickr.com/72/199481203_ad4cdcf109_s.jpg", title: "Flower6"},
  26.     {url: "http://static.flickr.com/58/199481218_264ce20da0_s.jpg", title: "Flower7"},
  27.     {url: "http://static.flickr.com/69/199481255_fdfe885f87_s.jpg", title: "Flower8"},
  28.     {url: "http://static.flickr.com/60/199480111_87d4cb3e38_s.jpg", title: "Flower9"},
  29.     {url: "http://static.flickr.com/70/229228324_08223b70fa_s.jpg", title: "Flower10"}
  30. ];
  31. function mycarousel_itemLoadCallback(carousel, state)
  32. {
  33.     for (var i = carousel.first; i <= carousel.last; i++) {
  34.         if (carousel.has(i)) {
  35.             continue;
  36.         }
  37.         if (i > mycarousel_itemList.length) {
  38.             break;
  39.         }
  40.         // Create an object from HTML
  41.         var item = jQuery(mycarousel_getItemHTML(mycarousel_itemList[i-1])).get(0);
  42.         // Apply thickbox
  43.         tb_init(item);
  44.         carousel.add(i, item);
  45.     }
  46. };
  47. /**
  48. * Item html creation helper.
  49. */
  50. function mycarousel_getItemHTML(item)
  51. {
  52.     var url_m = item.url.replace(/_s.jpg/g, \'_m.jpg\');
  53.     return \'<a href="\' + url_m + \'" title="\' + item.title + \'"><img src="\' + item.url + \'" width="75" height="75" border="0" alt="\' + item.title + \'" /></a>\';
  54. };
  55. jQuery(document).ready(function() {
  56.     jQuery(\'#mycarousel\').jcarousel({
  57.         size: mycarousel_itemList.length,
  58.         itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback}
  59.     });
  60. });
  61. </script>
  62. </head>
  63. <body>';
  64. require "connexionbase.php";
  65. $nomAlbum=$_GET['nomAlbum'];
  66. $sql="select * from photo ;";
  67. $result=mysql_query($sql);
  68. while ($row=mysql_fetch_array($result, MYSQL_BOTH)){
  69. }
  70. echo'
  71. <div id="wrap">
  72.   <ul id="mycarousel" class="jcarousel-skin-ie7">
  73.   </ul>
  74. </div>';
  75. echo '
  76. </body>
  77. </html>';
  78. ?>


 
merci.

Reply

Marsh Posté le 08-01-2010 à 16:50:21   

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed