I'm creating a page with two section where I load content .load() into #container by clicking on the titles.
<div id=dogs>[dogs]</div>
<div id=cats>[cats]</div>
<div id=#container></div>
<div class=button_dogs></div>
My problem
I have a right-bottom fixed button that I only want it to be displayed in the section #dogs section (not in the cat section), and the page initializes by default with #dog section, so my code is something like that
$("#container").load("content.php?s=dogs"); //initial
$("#cats").click(){function(){
$("#container").load("content.php?s=cats"); //after click
$(".button_dogs").hide();
$(window).unbind(".button");
}}
$("#dogs").click(){function(){
$("#container").load("content.php?s=dogs"); //after click
$(".button_dogs").show();
$(window).bind("scroll.button");
}}
This is the fixed button binded to window
$(".button_dogs").hide();
$(window).bind("scroll.button", function(){
if($(this).scrollTop()>50) {
$(".button_dogs").show()
} else {
$(".button_dogs").fadeOut()
}
});
I don't know what I'm doing wrong, When clicking on #dogs it binds again the fixed button function, but it doesn't work with the effects of before.This is the line I have doubts about (from #dogs click event)
$(".button_dogs").show();
$(window).bind("scroll.button");
<div id="dogs">[dogs]</div><div id="cats">[cats]</div><div id="container"></div><div class="button_dogs"></div>- Barskey