开发者

jsFiddle works. Implementation on webpage doesn't?

This js fiddle runs with no errors or problems:

http://jsfiddle.net/3j45B/2/

However, when embedded within http://www.zabb.co.uk/untitled6.html it does not work? Any suggestions please?


EDIT:

Further to your comments and suggestions below a solution has been found, thank you all:

$(document).ready(function() {

    $('.thumbnail2').click(function() {
        src = $(this).attr('src');
        if (src != $('.img').attr('src')) {
            $('.img').fadeOut(250, function() {
                $(this).attr('开发者_运维百科src', src).fadeIn(250);
            });
        }
    });

});​

Important bit to ensure event works is to wrap your jQuery code within:

$(document).ready(function() {
    // ...
});​

See following link for further information regarding this function:

Introducing $(document).ready()


Wrap your embedded script in a $(...) or $(document).ready(...)

jsfiddle did that for you (see the dropdown box on the left that says "onLoad"?).


Nothing wrong with your code. But you probably forgot to include a plugin called Galleria, I get Galleria not defined.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜