簡體   English   中英

當屏幕寬度小於1024像素時調整圖像大小

[英]Resizing images when screen is less than 1024 pixels width

當屏幕寬度小於1024時,我試圖縮小圖像,但是它不起作用。 有人可以幫忙嗎?

<script type="text/javascript">
    if( $(window).width() < 1024)
        {
           $(".imagelist").animate({ width: '2750px',height:'540px'})1000
           $("img").animate({ width: '250px',height:'250px'})1000
        }  
});
</script>  

就像Mohamed-Yousef所說的那樣,您缺少逗號。 但是,還有其他一些語法問題。 嘗試:

<script type="text/javascript">
    if( $(window).width() < 1024)
    {
        $(".imagelist").animate({width:'2750px',height:'540px'}, 1000);
        $("img").animate({ width:'250px',height:'250px'}, 1000);
    }
</script>

大約})1000應該是},1000)

<script type="text/javascript">
 $(document).ready(function(){
    if( $(window).width() < 1024)
        {
           $(".imagelist").animate({ width: '2750px',height:'540px'},1000);
           $("img").animate({ width: '250px',height:'250px'},1000);
        }  
});
</script>  

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM