javascript - 显示更大的初始图像

标签 javascript jquery

我在页面加载时显示第一个较大的图像, 但我想在单击缩略图时显示更大的图像,最初我不想在加载页面时显示任何更大的图像。最初只应显示缩略图。

这是尝试过的链接:

http://jsfiddle.net/L7yKp/37/

最佳答案

听起来你想要的是这样的:

http://jsfiddle.net/L7yKp/38/

$("#panel img").hide(); //<= remove the :not(first-child) filter

$("#thumbs .UiUx3DSSVFlow").click(function(){
    getIndex = $(this).index();
    $("#thumbs .clicked").removeClass('clicked');
    $("#panel img").fadeOut('fast').eq(getIndex).fadeIn();  
    $(this).addClass('clicked');     
});

//$("#thumbs .UiUx3DSSVFlow:first").click(); //<= don't simulate the first click
$(['next','prev']).each(function(){
    var that=this;
    $('.'+that).click(function(){
        $('#thumbs .clicked')[that]().click();
    });
});
​

关于javascript - 显示更大的初始图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12153438/

相关文章:

JQuery fadeIn() 在 fadeIn() 上移动其他 CSS 元素

jquery - 如何在多个类(超过 2 个)之间切换?

javascript - 使用 jquery 附加按钮获取参数

javascript - 使用ajax mvc搜索数据时如何在查询字符串上保留id

jquery - 页面加载时元素高度的差异

javascript - 将 Python Post 请求更改为 Ajax Post 请求

javascript - 使用javascript减慢背景变化持续时间

javascript - 更改服务日历中的选定行 [CRM2013]

javascript - 是否可以使用 JS 打开 HTML 选择以显示其选项列表?

javascript - 函数参数是 native 元素还是 jQuery 集?