How to Create a CSS Page Loading Spinner - Web Design Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ธ.ค. 2024

ความคิดเห็น • 91

  • @BenjaminAster
    @BenjaminAster 2 ปีที่แล้ว +7

    1:57 to center an item, I would prefer a display: grid; and place-items: center; These are just two lines instead of three.

    • @sicfxmusic
      @sicfxmusic 2 ปีที่แล้ว +4

      OMG I saved 2 bytes!

    • @ronakexe
      @ronakexe ปีที่แล้ว +2

      Sometimes it doesn't work. It's better to use flex.

    • @DaMu24
      @DaMu24 ปีที่แล้ว

      @@ronakexe Flex doesn't work.

  • @BenjaminAster
    @BenjaminAster 2 ปีที่แล้ว +2

    3:06 instead of specifying a width and a height, you can just specify a width and then an aspect-ratio: 1;

  • @BenjaminAster
    @BenjaminAster 2 ปีที่แล้ว +4

    1:36 instead of specifying top, left, width & height you can just say inset: 0;

  • @TomasMisura
    @TomasMisura 2 ปีที่แล้ว +4

    this spinner has been immediately implemented into for my project. Thanks a lot for that !

  • @howinooz
    @howinooz 2 ปีที่แล้ว +3

    This was great. Thank you very much. You did me a big favor with this tutorial and the accompanying codepen. Thank you man.

  • @ДмитрийХарченко-ю5с
    @ДмитрийХарченко-ю5с ปีที่แล้ว

    Thanks, main idea is cleared. Good luck.

  • @benubaba9349
    @benubaba9349 2 ปีที่แล้ว

    Thank you, i will add this spinner in my project.

  • @ForfeitStudios
    @ForfeitStudios ปีที่แล้ว +1

    loader.addEventListener("transitionend", () => {
    document.body.removeChild(loader);
    can be removed it's not needed.

  • @ck0024
    @ck0024 2 ปีที่แล้ว

    Cool. Last part gave me some awesome ideas.

  • @siyavats6892
    @siyavats6892 ปีที่แล้ว

    Thank you so much for this video,was really looking for this kind of video

  • @oyuncubirlii
    @oyuncubirlii 2 ปีที่แล้ว

    amazing loading spinner!

  • @PunhwarCoding
    @PunhwarCoding 6 หลายเดือนก่อน +1

    Nice video

  • @ianonline
    @ianonline ปีที่แล้ว +1

    This looks great and it all makes sense, however it's not working for me, the screen just stays blank. Could it be because I'm masking the URL? The frame loads but after loading Dev Tools says

  • @RazifMohamed
    @RazifMohamed 2 ปีที่แล้ว

    very nice! easy to understand and follow

  • @backend_pinpost
    @backend_pinpost ปีที่แล้ว

    Thanks. So helpful

  • @husseincode
    @husseincode 2 ปีที่แล้ว +1

    Very good 👍🏻❤️

  • @digvijayyamagekar4300
    @digvijayyamagekar4300 ปีที่แล้ว

    nice and easy! , thank you

  • @NurioonSoftware
    @NurioonSoftware ปีที่แล้ว

    Good video. Thank you very much

  • @VocalCove
    @VocalCove ปีที่แล้ว

    Thank you very much bro..

  • @fazhari675
    @fazhari675 7 หลายเดือนก่อน

    Thanks mate !

  • @BenjaminAster
    @BenjaminAster 2 ปีที่แล้ว +1

    5:32 I have never understood this .loader--hidden naming convention. Why not just say .loader.hidden and then specify the "hidden" class in JavaScript?

    • @dcode-software
      @dcode-software  2 ปีที่แล้ว

      It's BEM. Having it as it's own class means your styles can be specific to the element you are trying to modify (in this case hide)

    • @BenjaminAster
      @BenjaminAster 2 ปีที่แล้ว

      @@dcode-software Ok but why don't just say .loader.hidden instead of .loader--hidden? That would also only apply to a .loader element with the class of .hidden.

    • @ck0024
      @ck0024 2 ปีที่แล้ว +1

      @@BenjaminAster specificity

  • @valona4432
    @valona4432 ปีที่แล้ว

    What font are you using for vs code

  • @allanfernz9356
    @allanfernz9356 2 ปีที่แล้ว

    Is DOMcontenLoaded a better pick instead of windowLoad

    • @dcode-software
      @dcode-software  2 ปีที่แล้ว

      DOM Content Loaded triggers once the document has been loaded (like the "skeleton") but Window On Load is when everything is loaded (e.g. includes images)

    • @Stallion45
      @Stallion45 2 ปีที่แล้ว

      In regards to the spinner and the page load…, if I have a lot of images on the page, or the visitor is on a slow connection, can I make this loader only display while image content in the view is not loaded…, then display as items further down the page load?

  • @codeaxen
    @codeaxen 2 ปีที่แล้ว

    wooow awesome thank you so very much my friend... was wondering how i could add a loader to my Laravel app. but this solved

  • @yuthcambo3712
    @yuthcambo3712 ปีที่แล้ว

    Big thank for this video

  • @atouchofa.d.d.5852
    @atouchofa.d.d.5852 2 ปีที่แล้ว

    Always valuable content

  • @sahirmmmdova5052
    @sahirmmmdova5052 2 ปีที่แล้ว

    You are amazing ,thank you a lot✨

  • @tpzd1063
    @tpzd1063 2 ปีที่แล้ว

    He’s redoing the old one, just better

  • @BenjaminAster
    @BenjaminAster 2 ปีที่แล้ว +2

    2:15 Instead of #333333, you could just say #333 to get the same gray.

    • @angladephil
      @angladephil 2 ปีที่แล้ว +3

      Instead of commenting, you should have published a tutorial!

    • @softwarelivre2389
      @softwarelivre2389 2 ปีที่แล้ว +2

      @@angladephil he is making a note. Why would he make a tutorial if he can comment a tip which is faster?

  • @M7ilan
    @M7ilan ปีที่แล้ว

    is there a way to make the loading page fade away when the requests is done because there's some requests still pending.

  • @brucew4545
    @brucew4545 ปีที่แล้ว

    If my site is using a Master Page, do I need to do anything different? I cannot get it to work.

  • @fola_azeez
    @fola_azeez 6 หลายเดือนก่อน

    Amazing thanks

  • @hassaneoutouaya
    @hassaneoutouaya 2 ปีที่แล้ว

    Thank you !

  • @mr7oda3
    @mr7oda3 2 ปีที่แล้ว

    it's amazing thank you

  • @shahidhsalarzai
    @shahidhsalarzai 2 ปีที่แล้ว

    hi should we use javascript cdn? i am facing the following exception
    Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

    • @jamesmassa1999
      @jamesmassa1999 2 ปีที่แล้ว

      Try this => document.body.removeChild(document.body.firstChild);

  • @yeomkyeokyeo
    @yeomkyeokyeo 2 ปีที่แล้ว

    Super cool thanks

  • @aaronmoroney2066
    @aaronmoroney2066 2 ปีที่แล้ว

    is the event listener javascript or jquery? I need to create a loading spinner for a student project but has to be css only

    • @dcode-software
      @dcode-software  2 ปีที่แล้ว +1

      Remember that jQuery is written in JavaScript. Event listeners are part of JavaScript

    • @aaronmoroney2066
      @aaronmoroney2066 2 ปีที่แล้ว

      @@dcode-software Thank you, I've just noticed in the course brief it says to just make it disappear after three seconds, and not after page load. it's just an intro in css animations I'm studying. thank you for getting back to me so quickly

  • @archangel_one
    @archangel_one ปีที่แล้ว +1

    0:09 9:44 NOT a CSS only page loader.

  • @wisdomugochukwu2249
    @wisdomugochukwu2249 ปีที่แล้ว

    Thanks man

  • @sulemanmughal5397
    @sulemanmughal5397 2 ปีที่แล้ว

    kudos brother

  • @homeoffice3524
    @homeoffice3524 ปีที่แล้ว +6

    Was good until you add js.

  • @lvekua
    @lvekua 2 ปีที่แล้ว

    It removes the loader however console shows following error: Uncaught DOMException: Node.removeChild: The node to be removed is not a child of this node - any suggestions?

    • @najmantube
      @najmantube 11 หลายเดือนก่อน +1

      I had that error too. This worked for me:
      loader.addEventListener("transitionend", () => {
      loader.remove()
      })

  • @chiroaksun8737
    @chiroaksun8737 2 ปีที่แล้ว

    Very nice :D Thx

  • @stephenoluwafemiherbert
    @stephenoluwafemiherbert 2 ปีที่แล้ว

    You are the best

  • @bryanthompson1070
    @bryanthompson1070 2 ปีที่แล้ว +2

    Nice simple little loader. Great video, thanks. I had two problems with it though. As mentioned by Lara below, I got the 'failed to removeChild on Node' error message. For some reason, transitionEnd fires twice so the code tries to remove the node after it's already been removed. I fixed this with:
    loader.addEventListener("transitionend", () => {
    if (document.querySelector(".loader")) {
    document.body.removeChild(loader)
    }
    })
    The second problem was I have some dynamically added text elements (checkmark & x) that were showing through the loader. I fixed this by setting the z-index on .loader to 100.

    • @laraliyn
      @laraliyn 2 ปีที่แล้ว +1

      I solved the problem by adding a seperate js file to the project.But I think according to what I have read, adding script before body in html creates such a problem.I hope this helps.

    • @jetalsavani2799
      @jetalsavani2799 2 ปีที่แล้ว

      My page loaded very fast ... that's why loader is not visible...🥲 Then what i have to do ??

    • @bryanthompson1070
      @bryanthompson1070 2 ปีที่แล้ว

      @@jetalsavani2799 Go to the network tab of your dev tools and choose throttling. Select slow 3G and you will see the loader.

    • @jetalsavani2799
      @jetalsavani2799 2 ปีที่แล้ว

      Thanks ☺️

    • @Stallion45
      @Stallion45 2 ปีที่แล้ว

      Nice... same issue here. Thought I was going crazy, but easy fix.

  • @mgt1708
    @mgt1708 ปีที่แล้ว

    thanks alot

  • @wujeonghyun6865
    @wujeonghyun6865 ปีที่แล้ว

    Mom, I kinda like this guy.

  • @kortisnet2315
    @kortisnet2315 ปีที่แล้ว

    loader--hidden is giving console error "Uncaught TypeError: Cannot read properties of null (reading 'classList')"

  • @PeriklesPeriklesoglu
    @PeriklesPeriklesoglu ปีที่แล้ว

    thanks

  • @Syedfarooque280
    @Syedfarooque280 ปีที่แล้ว

    Hi sir, my page has showing only image and not loading

  • @CARTOON-d1b6i
    @CARTOON-d1b6i ปีที่แล้ว

    thnks .brdh

  • @myriamleclerc846
    @myriamleclerc846 ปีที่แล้ว

    I paste everything but when i put the loader--hidden in the html my loading spinner just gets hidden for good. And if i don't put it it's just fixed everywhere. Does anyone has had the same problem??

  • @yusufakkurt2308
    @yusufakkurt2308 2 ปีที่แล้ว

    Awesome!

  • @laraliyn
    @laraliyn 2 ปีที่แล้ว

    After I added this spinner, everything worked fine. Although loader is removed from page flow, still in the console, "Uncaught DOMException: Failed to execute 'removeChild' on 'Node " error message shows up. Is there anyone has the same problem??

    • @bryanthompson1070
      @bryanthompson1070 2 ปีที่แล้ว

      See my comment above

    • @jamesmassa1999
      @jamesmassa1999 2 ปีที่แล้ว

      Try this => document.body.removeChild(document.body.firstChild);

  • @antonwahyudi2441
    @antonwahyudi2441 2 ปีที่แล้ว

    terimakasih, thanks :)

  • @smoothbeak
    @smoothbeak 2 ปีที่แล้ว

    Lovely!

  • @GravityFrag
    @GravityFrag ปีที่แล้ว

    nice thx u

  • @tyscyre2256
    @tyscyre2256 2 ปีที่แล้ว

    Why don't you just make the display of the loader to be none after the page has loaded?

  • @michalkichal2436
    @michalkichal2436 ปีที่แล้ว

    class="loader" doesn't change to class="loader loader--hidden" pls help i'm trying to fix this for few hours

  • @Hyper_Futbuss
    @Hyper_Futbuss ปีที่แล้ว

    Yeah

  • @dean719
    @dean719 ปีที่แล้ว

    There is an issue with the javascript

  • @DaMu24
    @DaMu24 ปีที่แล้ว

    does not work

  • @hermankeller1071
    @hermankeller1071 2 ปีที่แล้ว

    promosm

  • @beegoodb1213
    @beegoodb1213 9 หลายเดือนก่อน

    Thank you sir!