Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Extend readme #2296

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,56 @@ See the [project page](http://fancyapps.com/fancybox/3/) for documentation and a

Follow [@thefancyapps](//twitter.com/thefancyapps) for updates.


## Quick start

1\. Add latest jQuery and fancyBox files
1\. Add latest jQuery and fancyBox files

```html
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>

<link href="/path/to/jquery.fancybox.min.css" rel="stylesheet">
<link href="/path/to/jquery.fancybox.min.css" rel="stylesheet" />
<script src="/path/to/jquery.fancybox.min.js"></script>
```


2\. Create links
2\. Create links

```html
<a data-fancybox="gallery" href="big_1.jpg">
<img src="small_1.jpg">
<img src="small_1.jpg" />
</a>

<a data-fancybox="gallery" href="big_2.jpg">
<img src="small_2.jpg">
<img src="small_2.jpg" />
</a>
```


3\. Enjoy!

## Usage with webpack

If you encounter a `jQuery is not defined` message when using webpack to bundle fancybox, you can add jquery as a webpack plugin. This will make sure jquery is exposed globally.

```js
//webpack.config.js
...
plugins: [
new webpack.ProvidePlugin({
'window.$': 'jquery',
'window.jQuery': 'jquery',
'window.jquery': 'jquery',
$: 'jquery',
jQuery: 'jquery',
jquery: 'jquery',
})
]
...
```

After you do this, you can just require fancybox without even requiring jquery:

```js
import fancybox from '@fancyapps/fancybox';
```

## License

Expand All @@ -56,7 +78,6 @@ Guidelines for bug reports:
A good bug report shouldn't leave others needing to chase you up for more information.
Please try to be as detailed as possible in your report.


Feature requests are welcome. Please look for existing ones and use GitHub's "reactions" feature to vote.

Please do not use the issue tracker for personal support requests - use Stack Overflow ([fancybox-3](http://stackoverflow.com/questions/tagged/fancybox-3) tag) instead.