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

Slider and checkbox: when using the checkbox, the slider doesn't work anymore #66

Open
lonne12 opened this issue Apr 2, 2020 · 1 comment

Comments

@lonne12
Copy link

lonne12 commented Apr 2, 2020

We connected the slider with a checkbox in a navbar for an interactive web map. The default is an unchecked box. When checking the box for the first time everything works fine. If we then uncheck the box and check it again, you can only move the slider once and then it is stuck. Then there is no interaction possible at all. But we do not get an error message.
The slider is connected to a geojson file.
Do we have to update the slider or anything like that?

What happens:
grafik

The code for the navbar:

<div class="navbar">
	<div class="navbar-header">
      <a class="navbar-brand" ><i class="fas fa-suitcase"></i>  Planer</a>
    </div>
	<div class="navbar-content">
		<div class="dropdown">
			<button class="dropbtn">History <i class="fa fa-caret-down"></i></button>
			<div class="dropdown-content">
			  <a>
				<label class="switch">
					<input type="checkbox" onclick="sliderOn()" id="sliderBox" autocomplete="off">
				</label>Hotels  <i class="fa fa-bed"></i></a>	
			</div>
		</div>
	</div> 
</div>

JS-code:

var sliderControl = L.control.sliderControl({layer:hotel, follow: false, range: true});

function sliderOn(){
	var checkbox = document.getElementById('sliderBox');
	
	if (checkbox.checked == true){
		map.addControl(sliderControl);
		sliderControl.startSlider();
	} else {
		sliderControl.remove();	  
	};

};	
@Falke-Design
Copy link

Falke-Design commented Apr 16, 2020

Should be fixed in https://github.com/Falke-Design/LeafletSlider

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

2 participants