Reputation: 11
In a page with vertically stacked sections, one of these sections contains a jquery accordion.
The first accordion UL (green in picture) is $(window).height()-ConstantPixels
, so that the accordion takes 100% of the available height. (red box represents browser window).
Which means that sometimes a part of it will ne hidden.
So what i'm trying to accomplish is to start increasing the green UL's height when scrolling down, until all green content is visible. Any suggestions? thank you
Upvotes: 1
Views: 856
Reputation: 6111
var no=1,new= $('#div').height();
$(window).scroll(function () {
if(no==1)
{
if ($(window).height() + $(window).scrollTop() == $(document).height()) {
no=2;
$.ajax({
type: "POST",
url: "request.php",
data: datas,
cache: false,
success: function(html){
$('#div').height($(document).height()+new);
}
});
}
}
});
Upvotes: 0
Reputation: 5238
If you share some code I probably can help better, but here's the general idea.
You can listen to the scroll event of the browser, and set the height dynamically for that specific div. Something like this:
$(document).scroll(function(e){
var currentHeight = $('#greendiv').height();
$('#greendiv').height(currentHeight + $(document).scrollTop());
});
Something like that. Is that what you're looking for?
Upvotes: 2