How to pass dynamic value to other plugin parameters in jQuery (from accordion to localscroll)

So here is my setup. I have two columns on my page. In the left column, I have an accordion, and below I have text with links inside it. In the right column, I have some images that are controlled by links inside the text in the left column. Images can be scrolled.

On my page, I have an accordion that works great and is configured as

$( "#accordion" ).accordion({
    autoHeight: false,
    navigation: true,
    change: function(event, ui) { dynamicOffsetValue(); }/*This here call the dynamicOffsetValue function after the accordion has finished animation*/
});

Then I have a function that gives me the height of the div, which is wrapped around accoridon

function dynamicOffsetValue()
{
    var top = $("#accordion").height();/*IF I ALERT THIS THEN IT GIVES ME THE NUMBER I NEED*/
}

dynamicOffsetValue();

Then I also have the localscroll plugin setting for images in the right column

  var scrollOptions = {
      target:div#overflow, /* the element that has the overflow and contains images*/
      offset:500,/*HOW TO I MAKE THIS EQUAL TO dynamicOffsetValue ???*/
      axis: 'xy',
      duration: 50,  
      easing: 'swing'
    };

$('.scrollContainer').localScroll(scrollOptions);/*.scrollContainer(this element wraps both left and right column) */

, , , , , , . , 500 .

, , , dynamicOffsetvalue scrollOptions, , ( localscroll), ?

, .:)

+3
2

(href="#my_id") , , ?

0

, , . ( )

. , , localscroll, , scrollOptions. , localscroll dynamicOffset, (localscroll) re , , (localscroll) .

    $( "#accordion" ).accordion({
        autoHeight: false,
        navigation: true,
        change: function(event, ui) { dynamicOffsetValue(); }/*This here call the dynamicOffsetValue function after the accordion has finished animation*/
    });


    function dynamicOffsetValue()
    {
        var top = $("#accordion").height();/*IF I ALERT THIS THEN IT GIVES ME THE NUMBER I NEED*/

          var scrollOptions = {
          target:'div#overflow', /* the element that has the overflow and contains images*/
          offset:top,/*THIS NOW EQUALS TOP*/
          axis: 'xy',
          duration: 50,  
          easing: 'swing'
        };

    $('.scrollContainer').localScroll(scrollOptions);/*.scrollContainer(this element wraps both left and right column) */

    }

    dynamicOffsetValue();
0

All Articles