zurb/foundation — pull request #3253 by arthurio (2013-09-13 00:37:18+00:00)
Title: dropdown callbacks can be overridden after the first instanciation of the dropdown plugin

## Problem

Currently you can set the opened and closed callbacks only on the first init of the dropdown because of the following code:

```javascript
.on('opened.fndtn.dropdown', '[data-dropdown-content]', this.settings.opened)
/* If you change the settings.opened function,
the "on" will still use the first version you gave him...*/
```

Using the following code forces "on" to use the new function set in the settings:

```javascript
.on('opened.fndtn.dropdown', '[data-dropdown-content]', function () {
self.settings.opened.call(this); // Dynamically call self.settings.opened
})
```

The callback functions will be updated each time you initialize the dropdown function as follow:

```
$(document).foundation('dropdown', {opened: myOpenedCallback, closed: myClosedCallback});
```

## Test

You can test it yourself:

HTML:
```html
Click me
```

Javascript:
```javascript
callback = {click: function () {console.log(1); return false;}}
$(document).on('click', '#myTestButton', callback.click);
$('#myTestButton').trigger('click'); // display: 1

callback.click = function () {console.log(2); return false;}
$('#myTestButton').trigger('click'); // display 1 instead of 2...
```