Last active
April 27, 2016 02:07
-
-
Save franzejr/b8422ae920e8b7df8766062a87ec2998 to your computer and use it in GitHub Desktop.
My 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 myWrongComponent = React.createClass({ | |
changeVisibility: function(scroll){ | |
if (scroll >= 100) { | |
$(".my-fixed-div").css('visibility', 'visible'); | |
} | |
else{ | |
$(".my-fixed-div").css('visibility', 'hidden'); | |
} | |
}, | |
componentDidMount: function () { | |
$(window).scroll(function () { | |
var scroll = $(window).scrollTop(); | |
// some logic ... | |
} | |
this.changeVisibility(scroll); | |
}.bind(this)); | |
}, | |
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