1

Since I started this new webshop for a friend to launch, which still in progress, I'm using the so called "jQuery fixedScroll"..

Project online: http://www.merkversterkers.com/klanten/fragma/index.php?p=shop

Everything is fine until this.. When I'm using the scrollplugin, it defines the height of the page, which a good thing..

After pressing the "filter" button the height must be predefined causing a div that will expand, and I'm unable to do that, because the document defines the height when it's loaded..

like the "$(document).ready" function

scrollfunction

$('#scart').scrollToFixed({
   marginTop: $('.topbar').outerHeight() + 30,
   limit: get_limit(),
   zIndex: 999
});

get_limit functon

function get_limit(){
    var products_row = 4;

    var topbar = $(".topbar").height() + 30 
    var filterbar = $(".filterbar").height();
    var products = products_row * 206;

    if( $(".filterexpanded").css('display') == "block" ){
        var expanded = $(".filterexpanded").height(); 
    } else {
        var expanded = 0;
    }   

    var cartheight = $("#scart").height();

    var limit = topbar + filterbar + expanded + products + 130 - cartheight;

    return limit;
}

Can someone give me throw of some code I could try? I would really appreciate all the help..

4

3 回答 3

1

在不阅读问题的情况下,您应该更改以下内容:

limit: get_limit(),

对此:

limit: get_limit,
于 2012-02-07T00:55:33.810 回答
1

当您尝试将函数设置为对象中的值时,不应使用括号。当你这样做时,你基本上是在评估函数,它的值将被返回而不是实际的函数。

var myObject = {
    myFunction: funkyFunk()
};

function funkyFunc(){
    var funkierFunction(){
        // You COULD do this
    };
    return funkierFunction;
}

但这是你需要的...

var myObject = {
    myFunction: funkyFunk
};

function funkyFunc(){
    // You probably want this though    
}
于 2012-02-07T01:00:43.073 回答
0

查看插件的源代码后的(未经测试的)想法:

var scrollToFixedObj = $('#scart').data("ScrollToFixed");
scrollToFixedObj.options.marginTop = get_limit();
于 2012-02-07T01:22:14.890 回答