No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Tooltips showing on elements outside of viewport

    Help
    2
    7
    385
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • X
      xdesai last edited by

      I have a scenario where I need to show a lot of tooltips simultaneously which I control through a v-model. However, some of these elements are out of the current viewport further down the page - when I set the model, all the tooltips for those elements pop up at the bottom of the screen - is there any way to hide those ones until their elements come into view?

      I tried using an intersection component, but that didn’t work.

      Here is a codepen to simulate what I mean:
      https://codepen.io/xariusdesai/pen/abBzrwq?editors=101

      I’ve put a dummy div with a height of 900px to hide the element, but the tooltip is still showing.

      Any ideas?

      Cheers,
      Xarius

      beets 1 Reply Last reply Reply Quote 0
      • beets
        beets @xdesai last edited by

        @xdesai The Quasar position engine just works that way where it bounds it to the viewport. I think you had the right idea to use an intersection observer. What I would do is make the toggle set a value shouldShow to true, and then when the intersection observer fires, check if it showing and shouldShow, and toggle the tooltip. Same when the intersection observer fires to hide, then hide the tooltip. Managing state for each element is a bit tricky, but you could even make a component wrapper that handles this.

        X 1 Reply Last reply Reply Quote 0
        • X
          xdesai @beets last edited by

          @beets Ah, thats not going to work (neither will intersection observer now that I’ve played around a bit more) - the reason I wanted to show all the tooltips is because this is a layout for a printed report - using an intersection hides everything not in view!

          I think I’m going to have to manually recreate the divs and use css to manually place them for the printed version.

          beets 1 Reply Last reply Reply Quote 0
          • beets
            beets @xdesai last edited by beets

            @xdesai I think it can still work, instead of conditionally showing the tooltip, conditionally apply a content-class="hide-me" to the tooltip. Then with css:

            @media screen {
              .hide-me { display: none }
            }
            

            Edit: actually quasar has a css class to help here: print-only. So basically with the intersection observer, when the element is out of the viewport, add print-only. When it goes back into the viewport, remove the print-only class.

            X 1 Reply Last reply Reply Quote 0
            • X
              xdesai @beets last edited by

              @beets Won’t that mean I have to manually move over each page and print? My report has multiple pages - I just want to load the page and immediately fire the print command.

              beets 1 Reply Last reply Reply Quote 0
              • beets
                beets @xdesai last edited by

                @xdesai here’s what I was trying to explain: https://bncr9.sse.codesandbox.io/ (source: https://codesandbox.io/s/boring-tereshkova-bncr9 )

                However I do notice that the tooltips aren’t exactly aligned on the print preview though. This is likely just due to the absolute positioning. So instead maybe you can show an inline div with the print-only class.

                X 1 Reply Last reply Reply Quote 0
                • X
                  xdesai @beets last edited by

                  @beets I ended up just creating a conditional div and used css positioning. Thanks for the help though!

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post