Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/437.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Jquery animate()函数不适用于css height属性_Javascript_Jquery_Css - Fatal编程技术网

Javascript Jquery animate()函数不适用于css height属性

Javascript Jquery animate()函数不适用于css height属性,javascript,jquery,css,Javascript,Jquery,Css,我想为图像创建一个单击事件,以自动将高度更改为100%,而将其他图像的高度更改为0。你可以在网站www.nhadatsonnghia.com nhađ上看到它的实时运行ất gòvấp 下面是我尝试过的代码。有人能帮我吗?非常感谢 $('.post-header .desc-image-list .thumb .natural-thumbnail').click(function () { $(this).find('img').each(function () {

我想为图像创建一个单击事件,以自动将高度更改为100%,而将其他图像的高度更改为0。你可以在网站www.nhadatsonnghia.com nhađ上看到它的实时运行ất gòvấp

下面是我尝试过的代码。有人能帮我吗?非常感谢

$('.post-header .desc-image-list .thumb .natural-thumbnail').click(function () {
        $(this).find('img').each(function () {
            var image_url_in_first_list = $(this).attr('src');
            $('.post-header .desc-image-list .full .natural-thumbnail').each(function () {
                if ($(this).css('height') == '100%') {
                    $(this).animate({
                        height : 0
                    }, 100, function () {
                        $('.post-header .desc-image-list .full .natural-thumbnail').each(function () {
                            if (image_url_in_first_list === $(this).find('img').attr('src')) {
                                $(this).animate({
                                    height : "100%"
                                }, 100);
                            }
                        });
                    });
                }
            });
        });
    });

请检查css是否被覆盖谢谢@VictorZyonTiangson我通过在桌面和手机上更改为600px解决了这个问题!祝你今天愉快,兄弟!没问题,伙计!我很高兴你能解决你的问题。