treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Image slider help

  • Hi all.

    Hopefully this is just gunna be a quick answer thing. Basically ive got a site that i've been doing very slowly every now and then with wordpress (1st attempt). Well i put in a jquery slider that i downloaded and it has 8 images that slide.

    Can anyone give me some info so i could lower that number to say 4 images instead ?

    I've looked in the scripts.js file but cant find it !!

    Cheers in advance
  • remove last 4 slides from slider.data variable.
  • OK cheers for the advice hardix. Ive located the slider.data, but not too sure on what to do next.

    Here is what it looks like

    var d=slider.data;
    for(var i=0;i $('#'+d[i].id).stop().animate({left:((i-pos)*1000)},1000,'swing');

    ????????
  • can anyone help ?
  • in your code if you look at this lines...


    <script type="text/javascript">
    if(!window.slider) var slider={};slider.data=[{"id":"slide-img-1","client":"A week in the life of a personal trainer","desc":"Ben Camara"},{"id":"slide-img-2","client":"Playing Abroad with Royal Racing Montegnee FC","desc":"Paul Topping"},{"id":"slide-img-3","client":"This is just a test","desc":"This is just a test"},{"id":"slide-img-4","client":"This is just a test","desc":"This is just a test"},{"id":"slide-img-5","client":"This is just a test","desc":"This is just a test"},{"id":"slide-img-6","client":"This is just a test","desc":"This is just a test"},{"id":"slide-img-7","client":"This is just a test","desc":"This is just a test"},{"id":"slide-img-8","client":"This is just a test","desc":"This is just a test"}];
    </script>


    this are the slider.data is an javascript array. just remove last 4 slide from this variable.
  • Ahhhhhhhh i see....thanks mate.
  • OK so i deleted it so i only had 4 like i wanted, but now it doesnt seem to slide any more but you can kinda see the images slide underneath the one that is still

    Hmmmmm any ideas ??
  • @hal8 after that you also need to take off

    <a href=""><img id="slide-img-5" src="http://planbfootball.com/wp-content/themes/Wordpress-FML/Images/nature-photo4.png&quot; class="slide" alt="" /></a> 
    <a href=""><img id="slide-img-6" src="http://planbfootball.com/wp-content/themes/Wordpress-FML/Images/nature-photo4.png&quot; class="slide" alt="" /></a>
    <a href=""><img id="slide-img-7" src="http://planbfootball.com/wp-content/themes/Wordpress-FML/Images/nature-photo6.png&quot; class="slide" alt="" /></a>


    and that will do it...
  • Ha. I am a doughnut !! Cheers