---
title: "FooBox jQuery Events"
id: "176489"
type: "knowledgebase"
slug: "foobox-jquery-events"
published_at: "2019-06-27T13:07:26+00:00"
modified_at: "2019-06-27T13:07:26+00:00"
url: "https://fooplugins.com/documentation/foobox/developers-foobox/foobox-jquery-events/"
markdown_url: "https://fooplugins.com/documentation/foobox/developers-foobox/foobox-jquery-events.md"
excerpt: "FooBox has a number of events that you can hook into, to customize the overall experience. Here are some of the more useful events and what they offer: Event Description Arguments foobox.beforeShow before the item is shown e.fb.item foobox.beforeLoad before..."
taxonomy_knowledgebase_cat:
  - "Developer Guides"
---

[Developer Guides](https://fooplugins.com/documentation/foobox/developers-foobox/)

# FooBox jQuery Events

## Related Articles

- [Disable FooBox on Mobile](https://fooplugins.com/documentation/foobox/developers-foobox/disable-foobox-on-mobile/)
- [FooBox CSS Cheat Sheet](https://fooplugins.com/documentation/foobox/developers-foobox/foobox-css-cheat-sheet/)
- [Add Image Click Navigation](https://fooplugins.com/documentation/foobox/developers-foobox/add-image-click-navigation/)
- [Changing The Background Color](https://fooplugins.com/documentation/foobox/developers-foobox/changing-background-color/)
- [Open Galleries In Lightbox From Text Link](https://fooplugins.com/documentation/foobox/developers-foobox/open-galleries-in-lightbox-from-text-link/)

**Need more help?** Browse all documentation or open a support ticket.

[All docs](/documentation/)

[Support](/support/)

FooBox has a number of events that you can hook into, to customize the overall experience. Here are some of the more useful events and what they offer:

| Event | Description | Arguments |
| --- | --- | --- |
| foobox.beforeShow | before the item is shown | e.fb.item |
| foobox.beforeLoad | before the item is loaded | e.fb.item |
| foobox.afterLoad | after the item is loaded | e.fb.item |
| foobox.afterShow | after the item is shown | e.fb.item |
| foobox.onError | when an error occurs while loading an item | e.fb.error |
| foobox.beforeResize | before the item is resized | e.fb.item |
| foobox.afterResize | after the item is resized | e.fb.item, e.fb.size |
| foobox.close | after closed |  |
| foobox.previous | after navigating previous |  |
| foobox.next | after navigating next |  |

## Bind To A Single Event

Bind using the FooBox container selector:

```
jQuery('.fbx-instance').on('foobox.afterLoad', function(e) {  alert(e.fb.item.url);  });
```

## Bind To A Multiple Events

Bind to multiple events (separated by spaces), again using the FooBox instance:

```
jQuery('.fbx-instance')  .on('foobox.close foobox.next foobox.previous', function(e) {  //do something  });
```

**WHERE DO I PUT THIS CODE?** If you are using the FooBox WordPress plugin, you can paste this javscript code into the FooBox settings page under JS & CSS > Custom Javscript (Pre). You can also put this code into a separate javscript file, which you can include in your theme.

Resources

## Find the right next step

Browse setup guides, get help with your site, or find licensing information.

![Image](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%200%200'%3E%3C/svg%3E)

### Documentation

Search setup guides, product docs, and troubleshooting articles.

[Browse docs](/documentation/)

![Image](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%200%200'%3E%3C/svg%3E)

### Support

Open a ticket with product details so we can help quickly.

[Get support](/support/)

![Image](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%200%200'%3E%3C/svg%3E)

### Licensing

Review account, renewal, refund, and license information.

[View details](/licensing/)
