What's new

Welcome to the forum 👋, Visitor

To access the forum content and all our services, you must register or log in to the forum. Becoming a member of the forum is completely free.

Help regarding issues of optimization speed

luckydead

New member
Joined
Nov 4, 2023
Messages
2
Reaction score
0
HTML Coins
0
Hello i'm trying to solve issues with website speed optimizations but i'm newbie to that point.
I have issue with background image loading largest contentful element using : This is the largest contentful element painted within the viewport

it shows me the problems is here: <div class="image-layer" style="background-image: url
so i found out that code and check it out

PHP:
public static function getHomeBannerSliderHtml(){
        $objData= HomeBannerModel::where(['status'=>'enable','location'=>'homePageBanner'])->orderBy('order','ASC')->get();
        $htmlContent="";
        foreach($objData as $val){
            if($val->start_date >= date('Y-m-d') && $val->end_date <= date('Y-m-d')){
                HomeBannerModel::where('id', $val->id)->update(['status' => 'disable']);
                continue;
            }
            $htmlContent .= '<div class="slide-item">
            <div class="image-layer" style="background-image: url('.url('storage/app/home-banners/' . $val->banner_image).');"></div>
            <div class="auto-container">
               <div class="content-box">
                  <h1>'.$val->banner_title.'
                  </h1>
               </div>
            </div>
         </div>';
        }
        return $htmlContent;
    }

and here is my css code:
CSS:
.banner-section .banner-carousel .slide-item .image-layer {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    -webkit-transform: scale(1);
    -ms-transform: scale(1);
    transform: scale(1);
    -webkit-transition: all 6000ms linear;
    -moz-transition: all 6000ms linear;
    -ms-transition: all 6000ms linear;
    -o-transition: all 6000ms linear;
    transition: all 6000ms linear
}

.banner-section .banner-carousel .active .slide-item .image-layer {
    -webkit-transform: scale(1.15);
    -ms-transform: scale(1.15);
    transform: scale(1.15)
}

.banner-section-two .slide-item .image-layer {
    position: absolute;
    left: 0;
    top: 112px;
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    -webkit-transform: scale(1);
    -ms-transform: scale(1);
    transform: scale(1);
    -webkit-transition: all 6000ms linear;
    -moz-transition: all 6000ms linear;
    -ms-transition: all 6000ms linear;
    -o-transition: all 6000ms linear;
    transition: all 6000ms linear
}

.banner-section-two .slide-item .image-layer {
    top: 0px !important;
}

Can someone help me how to improve it to load fast?
I have read instead div to use img but i fail the background image become like 100x100 size
 

Theme customization system

You can customize some areas of the forum theme from this menu.

  • Wide/Narrow view

    You can control a structure that you can use to use your theme wide or narrow.

    Grid view forum list

    You can control the layout of the forum list in a grid or ordinary listing style structure.

    Picture grid mode

    You can control the structure where you can open/close images in the grid forum list.

    Close sidebar

    You can get rid of the crowded view in the forum by closing the sidebar.

    Fixed sidebar

    You can make it more useful and easier to access by pinning the sidebar.

    Close radius

    You can use the radius at the corners of the blocks according to your taste by closing/opening it.

  • Choose the color combination that reflects your taste
    Background images
    Color gradient backgrounds
Back