I need some help adjusting some Javascript code to work in particular scenarios. I've never dabbled in JS so I don't really know how to go about doing this, but I understand the concept. I'm using this tutorial to help me.
The example he provides has a set of images and a textual link for each one. Clicking on a link adjusts the padding to view that current image in the designated frame. However, in the site I'm working on I only plan to have two links - arrows - for next and previous. What would be the best way to adapt the JavaScript to handle this?
Original Code:
Code:
I'm thinking I'd need something like this:
Code:
Like I said, I'm no JavaScript coder so the above *is* incorrect syntax and execution. But, basically I'd need to add 450 pixels to the left element for each "next" and 450 for each "previous" link click. I'm also thinking of adding the "text links" he has but as the photos themselves. While his photos are in a frame, all/some of mine will be visible to the user, which they may instinctively click. If they do, I want that photo to get center attention - or at least progress the string of photos in that direction.
Secondly. This isn't as particular. My navigation has a :hover psuedo-class that adds a background. I need that to slide from nav link to nav link as the :hover changes. Is this CSS3 doable?
The example he provides has a set of images and a textual link for each one. Clicking on a link adjusts the padding to view that current image in the designated frame. However, in the site I'm working on I only plan to have two links - arrows - for next and previous. What would be the best way to adapt the JavaScript to handle this?
Original Code:
Code:
$(document).ready(function() {
$("#slide1-1").click(function() {
$("#slide1_images").css("left","0");
});
$("#slide1-2").click(function() {
$("#slide1_images").css("left","-450px");
});
$("#slide1-3").click(function() {
$("#slide1_images").css("left","-900px");
});
$("#slide1-4").click(function() {
$("#slide1_images").css("left","-1350px");
});
});
I'm thinking I'd need something like this:
Code:
$(document).ready(function() {
$("#next").click(function() {
$("#slide1_images").css("left",""+450);
});
$("#previous").click(function() {
$("#slide1_images").css("left",""-450px);
});
});
Like I said, I'm no JavaScript coder so the above *is* incorrect syntax and execution. But, basically I'd need to add 450 pixels to the left element for each "next" and 450 for each "previous" link click. I'm also thinking of adding the "text links" he has but as the photos themselves. While his photos are in a frame, all/some of mine will be visible to the user, which they may instinctively click. If they do, I want that photo to get center attention - or at least progress the string of photos in that direction.
Secondly. This isn't as particular. My navigation has a :hover psuedo-class that adds a background. I need that to slide from nav link to nav link as the :hover changes. Is this CSS3 doable?