JavaScript UI lag between my javascript and my ported elm

I have a navbar which needs to change colour on scroll. This functionality was originally built with js, however now it has a 'Login' button which is built in elm to perform other functionality.

I used a port and subscription to change the colour of the elm login button using the original js. The colour change works however sometimes there is a lag between the login button and the rest of the navbar changing colour and so the button momentarily disappears. Sometimes however the colour change is seamless.

I tried switching the order in which the js function and the subscription was sent to see if it would make a difference, but it didn't. I understand the fact that elm is asynchronous will impact the order in which it/the js displays but I'm not sure how I can make it smooth in this situation.

Does anyone know how I can remove this lag?

Here is the js ports code:

window.onscroll = function() {
  if (this.scrollY <= 20) {
    if (!isTop) {
      isTop = true;
      setTransparentNav(); // this is a simple CSS class change fn
      app.ports.colorChanges.send(isTop); // this is the UI which is lagging
    }
  } else {
    if (isTop) {
      isTop = false;
      setBlackNav();
      app.ports.colorChanges.send(isTop);
    }
  }
};

This is the port in the Elm:

port colorChanges : (Bool -> msg) -> Sub msg

The message it sends is a simple Bool which when True dictates which classes are used.

Answer:1

Prelog: I have implemented Google maps and Geolocation as a independent widgets, Now the user have the ability to add the widget as much as he wants in a page he is owns. I am using $.getScript(URl, ...

Prelog: I have implemented Google maps and Geolocation as a independent widgets, Now the user have the ability to add the widget as much as he wants in a page he is owns. I am using $.getScript(URl, ...

  1. you have included the google maps

I have Table (Employees) A: +----+---------+ | ID | NAME | +----+---------+ | 1 | ROBERT | | 2 | JAMES | | 3 | RICHARD | | 4 | KANYE | | 5 | DYLAN | | 6 | JOHN | | 7 | JEAN | | ...

I have Table (Employees) A: +----+---------+ | ID | NAME | +----+---------+ | 1 | ROBERT | | 2 | JAMES | | 3 | RICHARD | | 4 | KANYE | | 5 | DYLAN | | 6 | JOHN | | 7 | JEAN | | ...

  1. hide rows table jquery
  2. hide rows table html
  3. hide rows table
  4. hide rows table in word
  5. hide table rows javascript
  6. hide table rows css
  7. hide table rows in confluence
  8. hide table rows in word 2016
  9. hide table rows excel
  10. hide table rows using css
  11. hide table rows using jquery
  12. hide table rows using javascript
  13. hide table rows with empty td element
  14. hide table rows asp.net
  15. hide table rows if empty
  16. hide table rows filter
  17. hide table rows with button
  18. hidden table rows css
  19. hide rows pivot table
  20. hide rows in table access

I have the following path: /s/STRINGINEED/abcdef/ How should I structure my regex to match STRINGINEED as a result? /s/ is a fixed path, so I would like to get any string between /s/ and the ...

I have the following path: /s/STRINGINEED/abcdef/ How should I structure my regex to match STRINGINEED as a result? /s/ is a fixed path, so I would like to get any string between /s/ and the ...

  1. find specific string in excel
  2. find specific string in python
  3. find specific string in list python
  4. find specific string in php
  5. find specific string regex
  6. find specific string in linux
  7. find specific string in excel cell
  8. find specific string matlab
  9. find specific string in file python
  10. find specific string in c#
  11. find specific string in file linux
  12. find specific string in array javascript
  13. find specific string in sql
  14. find specific string in text file powershell
  15. find specific string in all files linux
  16. find specific string in javascript
  17. find specific string in stored procedure
  18. find specific string in sql database
  19. find specific string in r
  20. find specific string in jquery

I want to call two functions passes via props on click. Note that both of them need arguments of their own. After a bit of searching on Stack Overflow, I found this solution: onclick={()=>{ f1(); ...

I want to call two functions passes via props on click. Note that both of them need arguments of their own. After a bit of searching on Stack Overflow, I found this solution: onclick={()=>{ f1(); ...

  1. react call multiple functions onclick
  2. react call multiple apis
  3. react call multiple functions onchange
  4. react call setstate multiple times
  5. react call render multiple times
  6. react native call multiple api
  7. react componentdidmount called multiple times
  8. react onclick multiple call
  9. react call two functions onclick
  10. calling multiple functions onclick react