0

I want to achieve a very simple effect to scroll divs when pressing an arrow button ... How do i do this?

Basically i have a maximum of 4 divs named:

Slideframe, slideframe1, slideframe2 and slideframe3

I have a PHP variable called count which generates the slideframe content based on a PHP loop which increments a variable called $count.

Therefore the count variable can be between 0 and 3.

I want buttons to scroll divs left and right based on the count variable If the count variable is 0 then no scroll buttons would appear. If the count variable is 1 or 2 then both left and right scroll buttons would be visible and woudl scroll the relevant divs. lastly if count = 3 then only a left arrow would be visible.

this is the javascript i use (in conjunction with jqmin liibary) to move the divs:

$(document).ready(function(){ 

 $("#one").click (function(){
          if (navi =1){
 $(".slideframe").animate({opacity: "0.1", left: "-=960"}, 1200);
 $(".slideframe1").animate({ left: "-=960"}, 1200);
  }
 }); 
});

"#one" = the id of the left arrow image.

Whats the simplest way of doing all of this?

thx

1 Answer 1

1

There are plenty of existing slider plugins and tutorials for jQuery. I suggest you check out:

13 Super Useful jQuery Content Slider Scripts and Tutorials

25 jQuery Image Gallery/Slider Tutorials and Plugins

Sign up to request clarification or add additional context in comments.

4 Comments

They rarely deal with a seperate php variable and im a complete noob .. i will look at them again though
Also i have tried multiple plugins and they never worked how i wanted, thats why i wrote my own up to this point....
I don't think the PHP side is that relevant. Your PHP should just render some HTML (say as an unordered list) that the jQuery then acts upon.
unfortunatly not, the php renders a loop which draw, dates, time, images. title and text into various divs, to create multi-layed "panes" of data from a CMS..... thats why the <ul> strategies wouldnt work for me (or maybe i just didnt understand enough at the time)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.