Created
April 27, 2016 02:07
-
-
Save franzejr/4ab85f846e0ff1abaabe7d435afeede9 to your computer and use it in GitHub Desktop.
Wrong Component using jQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myWrongComponent2 = React.createClass({ | |
changeVisibility: function(scroll){ | |
if (scroll >= 100) { | |
$(".my-fixed-div").css('visibility', 'visible'); | |
} | |
else{ | |
$(".my-fixed-div").css('visibility', 'hidden'); | |
} | |
}, | |
handleScroll: function () { | |
var scroll = $(window).scrollTop(); | |
// some logic ... | |
this.changeVisibility(scroll); | |
}, | |
componentDidMount: function () { | |
document.addEventListener('scroll', this.handleScroll); | |
}, | |
render: function(){ | |
return(<div className="fixed-div" />) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment