# Creating Flipbook

To create a flipbook, you need to&#x20;

Include scripts and style in your head of your HTML

```html
<link rel="stylesheet" type="text/css" href="css/flipbook.style.css">

<script src="js/flipbook.min.js"></script>
```

Create an element that will be container for flipbook, for example

```html
...
<body>
    <div id="container"></div>
</body>
...
```

and call the flipBook function with options.

### Flipbook from images

```javascript
const options = {
    pages: [
        {src: "book1/1.jpg", thumb: "book1/thumb1.jpg"},
        {src: "book1/2.jpg", thumb: "book1/thumb2.jpg"},
        ...
    ]
}
const container = getElementById('container');

new FlipBook(container, options)
```

#### Full code

```html
<!DOCTYPE html>
<html>

<head>
  <link rel="stylesheet" type="text/css" href="css/flipbook.style.css">
  <script src="js/flipbook.min.js"></script>

  <script type="text/javascript">
    document.addEventListener("DOMContentLoaded", function () {
      const options = {
        pages: [
          {src: "book1/1.jpg", thumb: "book1/thumb1.jpg"},
          {src: "book1/2.jpg", thumb: "book1/thumb2.jpg"},
          ...
        ]
      }
      const container = document.getElementById('container');
      new FlipBook(container, options);
    });
  </script>

</head>

<body>
  <div id="container"></div>
</body>

</html>

```

### Flipbook from PDF

```javascript
const options = {
    pdfUrl: 'pdf/1.pdf'
}
const container = getElementById('container');

new FlipBook(container, options)
```

#### Full code

```html
<!DOCTYPE html>
<html>

<head>
  <link rel="stylesheet" type="text/css" href="css/flipbook.style.css">
  <script src="js/flipbook.min.js"></script>

  <script type="text/javascript">
    document.addEventListener("DOMContentLoaded", function () {
      const options = {
        pdfUrl: 'pdf/1.pdf'
      };
      const container = document.getElementById('container');
      new FlipBook(container, options);
    });
  </script>

</head>

<body>
  <div id="container"></div>
</body>

</html>

```

### Creating flipbooks using jQuery synthax (legacy)

Flipbooks can also be created using jQuery, to support legacy code

<pre class="language-javascript"><code class="lang-javascript">jQuery(document).ready({
<strong>  jQuery("#container").flipBook(optinos)
</strong>})
</code></pre>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://real3dflipbook.gitbook.io/jquery/creating-flipbook.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
