Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to pass dynamic value to another plugins options in Jquery (from accordion to localscroll)
    text
    copied!<p>So here's my setup. On my page I have two columns. Inside the left column I have a accordion and below that i have some text with links inside it. In the right column I have some pictures that are being controlled by the links inside the text in the left column.The images can be scrolled. </p> <p>On my page I have a accordion that works fine and is setup like this</p> <pre><code>$( "#accordion" ).accordion({ autoHeight: false, navigation: true, change: function(event, ui) { dynamicOffsetValue(); }/*This here call's the dynamicOffsetValue function after the accordion has finished animation*/ }); </code></pre> <p>Then I have a function that gives me the height of a div that is wrapped around the accoridon</p> <pre><code>function dynamicOffsetValue() { var top = $("#accordion").height();/*IF I ALERT THIS THEN IT GIVES ME THE NUMBER I NEED*/ } dynamicOffsetValue(); </code></pre> <p>Then I also have a localscroll plugin setup for the images in the right column </p> <pre><code> 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) */ </code></pre> <p>Right now when the page loads and the first accordion is open and user clicks on a link that's inside the text , then the images get scrolled right where I want. But when the Accordion is opened in a different state then offset value 500 is not enough.</p> <p>How would I go about making it so that when the user clicks on on the accordion, then the dynamicOffsetvalue get's sent to scrollOptions and then when the user clicks on a link inside the text(this fires the localscroll) the new offset value is read?</p> <p>Hope all of this makes some sense. :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload