Tom Knowlton
asked on
Make carousel images clickable - jQuery
I request assistance in making the images clickable for the sequential images on the main page of my website.
Here is the live site URL:
http://www.utahkidsfoundation.com
Here is the live site URL:
http://www.utahkidsfoundation.com
ASKER
I am sorry...what I meant to say was....when you click on the image...it takes you to another URL.... like yahoo.com
ASKER
I put an alert( ) inside the function above and it is not firing.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Okay...the second function worked. Thank you.
How can I determine if
img.currentSrc
contains "1.jpg" or "2.jpg", etc.
How can I determine if
img.currentSrc
contains "1.jpg" or "2.jpg", etc.
try to understand the code...
var $img = $(this);
var img = $(this).get(0);
so use :
$(this).attr("src")
or :
$img.attr("src")
or :
img.src
var $img = $(this);
var img = $(this).get(0);
so use :
$(this).attr("src")
or :
$img.attr("src")
or :
img.src
ASKER
My final solution, based on leakim971's input.
$(document).on("click", "img.fotorama__img", function (event) {
var $img = $(this);
var img = $(this).get(0);
if (img.currentSrc.indexOf("1.jpg") >= 0) {
location.href = "MeetOurUtahKids.aspx";
}
if (img.currentSrc.indexOf("2.jpg") >= 0) {
window.open("http://www.facebook.com/groups/utahkids");
}
if (img.currentSrc.indexOf("3.jpg") >= 0) {
location.href = "ListOfNonProfits.aspx";
}
if (img.currentSrc.indexOf("4.jpg") >= 0) {
location.href = "Default.aspx";
}
});
ASKER
Excellent answer...and fast! Thanks!
Open in new window