how make a condition with events onclick click on button
hello there,
i am working with
window.pageYOffset. i use to know what is the position on Y to active a class in menu and to do a lot more things.
- window.onscroll = function () {
-
- //null
- if (window.pageYOffset >= 100){
- document.getElementById("menu-Bt1").className = "menu-bt";
- document.getElementById("menu-Bt2").className = "menu-bt";
- document.getElementById("menu-Bt3").className = "menu-bt";
- document.getElementById("menu-Bt4").className = "menu-bt";
- document.getElementById("menu-Bt5").className = "menu-bt";
- }
my big problem for now is how to make a condition.
- $('li.fields').filter(':nth-child(n+0)').addClass('hide');
-
- $('ul').on('click', 'li.title:nth-child(1)', function() {
- $(this).next(). slideToggle (200).siblings('li.fields').slideUp(200);
-
- window.onscroll = function () {
-
- //null
- if (window.pageYOffset >= 500){
- document.getElementById("menu-Bt1").className = "menu-bt";
- document.getElementById("menu-Bt2").className = "menu-bt";
- document.getElementById("menu-Bt3").className = "menu-bt";
- document.getElementById("menu-Bt4").className = "menu-bt";
- document.getElementById("menu-Bt5").className = "menu-bt";
- }
i have a default
window.pageYOffset = 100 , but when click i am looking for a toogle change . when
$('ul').on('click'
window.pageYOffset = 500 but when click again change the 500 to 100.
sorry for my bad english hope some one help me out.
i can put some example more later in jsfiddle thanks in advance