OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Mapbox on('load', function() shows data that should be hidden when I open the map

  • Thread starter Thread starter Camila Andino
  • Start date Start date
C

Camila Andino

Guest
I have set the 'Student Comments' layer as initially hidden using a setLayoutProperty call as seen here


Code:
map.on('load', function() {
map.setLayoutProperty('user-data-comments', 'visibility', 'none');
  map.setLayoutProperty('user-data-comments-text', 'visibility', 'none');
  });

However, when I open the interactive webmap, Mapbox displays the text before hiding it, when it should just appear hidden from the beginning. You can find the webmap here. I'm not sure if this is a bug or I have to re-write my code somehow. You can find the source code here.

Let me know what you think. Thanks!

<p>I have set the 'Student Comments' layer as initially hidden using a setLayoutProperty call as seen here</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>map.on('load', function() {
map.setLayoutProperty('user-data-comments', 'visibility', 'none');
map.setLayoutProperty('user-data-comments-text', 'visibility', 'none');
});</code></pre>
</div>
</div>
</p>

<p>However, when I open the interactive webmap, Mapbox displays the text before hiding it, when it should just appear hidden from the beginning. You can find the webmap <a href="https://camilaandinod.github.io/Project-test/index.html" rel="nofollow noreferrer">here</a>. I'm not sure if this is a bug or I have to re-write my code somehow. You can find the source code <a href="https://github.com/camilaandinod/Project-test/blob/master/index.html" rel="nofollow noreferrer">here</a>.</p>

<p>Let me know what you think.
Thanks!</p>
 

Latest posts

A
Replies
0
Views
1
Alvah_Franey
A
H
Replies
0
Views
1
habrewning
H
Top