Posted By

onefastsnail on 05/24/12


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

hurcy


cycle slides


 / Published in: JavaScript
 

  1. if ($('#featured').length>0){
  2. var titles = $('#featured-images').find("img").map(function()
  3. {
  4. return $(this).attr("title");
  5. });
  6.  
  7. counter=-1;
  8. imgs = new Array();
  9.  
  10. x=0;
  11. $("#featured-images img").each(function(index){
  12. console.log($(this).attr("alt"));
  13. imgs[x] = $(this).attr("alt");
  14. x++;
  15. });
  16.  
  17. $('#featured-images').before('<ul id="featurednav"></ul>').cycle(
  18. {
  19. pager: '#featurednav',
  20. after: function(currSlideElement)
  21. {
  22. counter++;
  23.  
  24. if(counter>=x){
  25. counter=0;
  26. }
  27.  
  28. $("#description").text(imgs[counter]);
  29. },
  30. pagerAnchorBuilder: function (index)
  31. {
  32. return '<li><a href="#">' + titles[index] + '</a></li>';
  33. }
  34. });
  35. }

Report this snippet  

You need to login to post a comment.