Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function only called once at beginning of created page #10

Open
KevinShianto opened this issue Jan 10, 2020 · 7 comments
Open

Function only called once at beginning of created page #10

KevinShianto opened this issue Jan 10, 2020 · 7 comments

Comments

@KevinShianto
Copy link

i have a component like this

<div class="background-footer" style="z-index: 1" v-view="handleScroll">
 <!-- content -->
</div>

and my script function only do console.log().

Why is it only trigger once instead of every time i scroll down the screen ?
Not like how it works in demo, every time i scroll down, the component updating its view property

@adarshmadrecha
Copy link

What is the size of your component?
Share your code in function handleScroll

@kagankorkmaz
Copy link

I have the same issue. Function is only called when page is created,

@bartboersma
Copy link

Same issue

@tako-sphynx
Copy link

No news on this?

@jsd219
Copy link

jsd219 commented Jan 28, 2021

Same issue

@aberfeldy
Copy link

aberfeldy commented Feb 15, 2021

Got a similar problem. the function will be called once when the site loads and after that never again, also the classes are not updated after scrolling the elements into the viewport.

<template>
  <vs-row ref="row" v-view="handler" vs-justify="center">
    <vs-col type="flex" vs-w="12">
      <vs-card class="card">
        <div slot="header">
[...]
<script>
  handler(e) {
    console.log(e)
  } 

Update: just found it it works on a normal page, but if I wrap my list into a div with a css (see below) to get a scrollable div instead of a long page it won't update anything.

.scroller {
  height: 80vh;
  overflow: auto;
}

@ansibleguy76
Copy link

ansibleguy76 commented Mar 25, 2022

In my case, i wanted to detect if a bulma-dropdown was out of sight and needed to decide whether to use a dropup instead. So basically I use this little piece of code during the dropdown toggle

          var ref=this
          this.$nextTick(()=>{
            // calculate if we need to do a dropup
            var dim = ref.$refs["dd"].getBoundingClientRect() // where dd is a reference to the dropdown content
            var wh = window.innerHeight
            // if dropdown is out out of view AND there is space for dropup, do dropup
            if((dim.bottom>wh) && (dim.top>dim.height)){
              ref.doDropUp=true
            }
          })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants