What I need:
- Show 'article_footer' by default
- When I pass 'article_footer_base' > 'article_footer' hides
- When I then scroll back up passed 'article_footer_base' > 'article_footer' then becomes visible again.
Tried a million things - cant get it to work :( Help!? The below just doesn't really work at all. I've just been trying to nab stuff of SO
My HTML:
<div class="d3-d10">
<div class="article_header">
<h1>{{ title }}</h1>
<ul class="center">
<li><a href="/profile/{{ username }}" class="user_avatar">{{ gravatamatic:quicky
email = "{email}"
size = "32"
}}</a></li>
<li><a href="/profile/{{ username }}">{{ username }}</a> on {{ current_date format="M jS, Y" }}</li>
</ul>
</div>
</div>
<div class="d3-d10 article_content">
{{ copy }}
</div>
<div class="d3-d10 source_link article_block_element">
{{ if source_link }}
<p class="center">Article originally published at {{ source_link }}</p>
{{ /if }}
<span class="icon-emblem"></span>
</div>
<div class="d3-d10 article_block_element article_footer_base">
<ul class="left">
<li><button class="global_btn_red"><span class="icon-upvote"></span>upvote</button> <span class="bold">23 people</span> have upvoted this</li>
</ul>
</div>
My footer (being called in a partial):
</section> <!-- Ending full width section -->
<div class="article_footer">
<ul class="left">
<li><button class="global_btn_red"><span class="icon-upvote"></span>upvote</button> <span class="bold">23 people</span> have upvoted this</li>
</ul>
<ul class="right">
<li><button class="global_btn_white"><span class="icon-saved"></span> save for later</button></li>
<li><a href="http://twitter.com/home?status={{ title }} https://thedigest.org/articles/{{ segment_3 }} - by @digestuk" target="blank" class="global_btn_white icon_btn_white"><span class="icon-twitter"></span></a></li>
<li><a href="http://www.facebook.com/sharer.php?u=https://thedigest.org/articles/{{ segment_3 }}" class="global_btn_white icon_btn_white"><span class="icon-facebook"></span></a></li>
<li><a href="mailto:support@thedigest.org" class="global_btn_white icon_btn_white"><span class="icon-flag"></span></a></li>
</ul>
</div>
My JS:
/**
* Article more dropdown
*/
$('.article_footer').show();
var entryheight = $('.article_footer_base').height();
$(document).scroll(function () {
var y = $(this).scrollTop();
if (y > 350 && y < entryheight) {
$('.article_footer').fadeOut();
} else {
$('.article_footer').fadeIn();
}
});