mapbox blurry popup
// Fix blurry mapbox popups due to transforms on non-even height & width element
// 1. Add class to popup when set with marker
new mapboxgl.Marker()
.setLngLat([obj.lng,obj.lat])
.setPopup(new mapboxgl.Popup({
offset: 25, maxWidth: '240px', className: 'makeMeEven'
})
.setHTML(html)
.addTo(map);
// 2. Using JQuery to make height & width even on map's mouseup event
map.on('mouseup', function(e) {
setTimeout(function(){ // Slight delay to allow popup to be added to DOM
$(".makeMeEven").each(function(){
$(this).width(Math.round($(this).width()/2)*2);
$(this).height(Math.round($(this).height()/2)*2);
});
}, 1);
});
Also in JavaScript:
- javascript remove last charter stings
- hide div in javascript
- prime numbers javascript
- add items to a react array in hooks
- obj[key].includes is not a function
- jquery empty and append
- javascript extend object
- firebase google yolo
- google docs api word count
- javascript looping through object
- pdf to image javascript
- interceptor error handling angular 9
- js destructuring explained
- how to smooth scroll in javascript
- how to load existing json data in nuxt
- jquery clear form values
- socket io query
- email validation in javascript
- jquery ajax form submission
- react gallery component
- Create MD5 hash with Node.js
- ajax stand for
- find base url in javascript
- angular datatable reload with pagination