asp.net - 将所有图像隐藏在 DIV 中,除了没有滚动条的图像

标签 asp.net css image html hide

我有一个 div 容器,我在其中显示多张图片,现在我只需要显示一张图片并隐藏其余图片。

那我该怎么做呢?

这是我的容器:

  <script type="text/javascript">
    // Convert divs to queue widgets when the DOM is ready
    $(function () {
        $("#uploader").plupload({
            // General settings
            runtimes: 'gears,flash,silverlight,browserplus,html5',
            url: 'Final.aspx',
            max_file_size: '10mb',
            max_file_count: 25,
            chunk_size: '1mb',
            unique_names: true,

            // Resize images on clientside if we can
            //                    resize: { width: 320, height: 240, quality: 90 },

            // Specify what files to browse for
            filters: [
        { title: "Image files", extensions: "jpg,gif,png" },
        { title: "Zip files", extensions: "zip" }
    ],

            // thumbnails
            thumb: { width: 100, height: 100, quality: 90 },

            // Flash settings
            flash_swf_url: 'js/plupload.flash.swf',

            // Silverlight settings
            silverlight_xap_url: 'js/plupload.silverlight.xap'
        });


        // Client side form validation
        $('form').submit(function (e) {
            var uploader = $('#uploader').plupload('getUploader');

            // Files in queue upload them first
            if (uploader.files.length > 0) {
                // When all files are uploaded submit form
                uploader.bind('StateChanged', function () {
                    if (uploader.files.length === (uploader.total.uploaded + uploader.total.failed)) {
                        $('form')[0].submit();
                    }
                });

                uploader.start();
            }
            else
                alert('You must at least upload one file.');

            return false;
        });
        var uploader = $('#uploader').plupload('getUploader');
        uploader.bind('FileUploaded', function (up, file, res) {

            $('#showfilelist').append("<div id=" + file.id + " class='thumb'><a href='uploads/" + document.getElementById("currentDirectory").value + "/" + file.name + "' target='_blank' rel='gallery'><img src='uploads/" + document.getElementById("currentDirectory").value + "/" + file.name + "' width='50' height='50'/></a></div>");

        });    
    });

最佳答案

可能是这样的:

$('#showfilelist div').hide();//隐藏所有附加的 div
$('#showfilelist div').eq(0).show();//显示第一个

关于asp.net - 将所有图像隐藏在 DIV 中,除了没有滚动条的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7957552/

相关文章:

javascript - 标记在 Asp.net 中的格式不正确

c# - 如何在C#(ASP.Net)中调用参数化存储过程?

css - Bootstrap 4 : col-auto but not horizontally aligned

javascript - 无法隐藏 <em>-Element,它在 Javascript 中作为 String 添加; textContent 不隐藏

css - Chromium @font-face 缓存行为 (FOIT)

css - 独立于蒙版的动画图像?

javascript - 手动添加节点到 JavaScript InfoVis Toolkit Force Directed Graph

c++ - 如何使用 C++ 清除 OpenCV 中的白色背景?

javascript - 来自不同域区域的内容安全策略和 Google Analytics 图像

.net - 在 ASP.NET 或 ASP.NET MVC 中生成管理界面