开发者

How do i make the images in rCarousel links?

http://ryrych.github.com/rcarousel/

so i'm using the carousel from the above link (open source) and i'm trying to use the below jQuery code to make the images inside the carousel div into links

$('#carousel li img').click(function() {
    var url = 'http://www.g开发者_开发问答oogle.com';
    window.open(url);
});

but it's not working, could someone help me? Is there a jQuery pluggin that would help me overide the rCarousel coding to help make the link creation work? I don't think i have the expertise to go through the entire rCarousel script to make the changes i need in order for the img links to start working. Is there an easy way out of this problem?


This works:

$("#carousel").click(function(e) {
    if (e.target.tagName == 'IMG') {
        // url can be anything - it can be also something associated with the image like its src attribute: e.target.src
        var url = 'http://google.com'
        window.open(url);
    }
})
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜