January 28, 201016 yr Hi, I've found some great templates and jQuery scripts. One invovles having a UL with individual LI picture elements inside. <div id="slider"> <ul> <li><a href="http://webaddress"><img'>http://webaddress"><img'>http://webaddress"><img'>http://webaddress"><img'>http://webaddress"><img src="images/02.jpg" alt="" /></a></li> <li><a href="http://webaddress"><img src="images/03.jpg" alt="" /></a></li> <li><a href="http://webaddress"><img src="images/04.jpg" alt="" /></a></li> <li><a href="http://webaddress"><img src="images/05.jpg" alt="" /></a></li> </ul> </div> When you click on the slider div, this function starts to run: this.each(function() { var obj = $(this); var s = $("li", obj).length; var w = $("li", obj).width(); var h = $("li", obj).height(); .... this basically gets the number of LI elements in #slider, their width and height and along with the rest of the code enables you to slide back an forth the content of slider, so you only see one picture element at a time. However, I am updating the LI elements on the fly, appending LI to the UL from an XML list of image sources. $(document).ready(function(){ $.ajax({ type: "GET", url: "sites.xml", dataType: "xml", success: function(xml) { $(xml).find('site').each(function(){ var id = $(this).attr('id'); $('#k').append('<li><a href="http://webaddress"><img src="images/'+id'.jpg" alt="" /></a></li>'); }); } }); }); Now I want to feed the number of total child elements in the XML to the previous function, so its knows how many LI elements there are. Any ideas how I would go about that?
Create an account or sign in to comment