• 06-12-2021, 13:11:20
    #1
    Kimlik doğrulama veya yönetimden onay bekliyor.
    function imglazy($filen,$altn,$classn) {
        global $imagepath;
        global $cdnsource;
    echo '<picture>
    <source media="(min-width: 1025px)"
        data-srcset="'.$cdnsource.$imagepath.$filen.'-fl.webp"
        type="image/webp">
    <source media="(max-width: 1024px)"
        data-srcset="'.$cdnsource.$imagepath.$filen.'-bg.webp"
        type="image/webp">
    <source media="(max-width: 768px)"
        data-srcset="'.$cdnsource.$imagepath.$filen.'-md.webp"
        type="image/webp">
    <source media="(max-width: 480px)"
        data-srcset="'.$cdnsource.$imagepath.$filen.'-sm.webp"
        type="image/webp">
    
    <source media="(min-width: 1025px)"
        data-srcset="'.$cdnsource.$imagepath.$filen.'-fl.jpg"
        type="image/jpeg">
    <source media="(max-width: 1024px)"
        data-srcset="'.$cdnsource.$imagepath.$filen.'-bg.jpg"
        type="image/jpeg">
    <source media="(max-width: 768px)"
        data-srcset="'.$cdnsource.$imagepath.$filen.'-md.jpg"
        type="image/jpeg">
    <source media="(max-width: 480px)"
        data-srcset="'.$cdnsource.$imagepath.$filen.'-sm.jpg"
        type="image/jpeg">
    <img
        data-srcset="'.$cdnsource.$imagepath.$filen.'-bg.jpg,
            '.$cdnsource.$imagepath.$filen.'-md.jpg,
            '.$cdnsource.$imagepath.$filen.'-sm.jpg"
        data-src="'.$cdnsource.$imagepath.$filen.'-fl.jpg"
        alt="'.$altn.'"
        class="lazyload '.$classn.'">
    </picture>';
    }
    Merhaba yukarıdaki gibi bir fonksiyon oluşturdum. Bu fonksiyon ile resimlerimi ekrana bastırıyorum. Fakat sorunum mobilden denediğimde -bg olan yapımı alıyor. Ama -sm olanı kullanması gerekmiyor mu? Nerde hata yapıyorum.
  • 06-12-2021, 13:22:18
    #2
    sadece max width dediğin için olabilir hocam. Örnek min width 481px and max width 768px gibi. Bu şekilde bi deneyebilir misin.
  • 06-12-2021, 14:25:10
    #3
    olumsuz hocam olmadı