Skip to content

Commit d61fffc

Browse files
committed
added wordpress cookbook
1 parent ad1bfc9 commit d61fffc

File tree

2 files changed

+41
-6
lines changed

2 files changed

+41
-6
lines changed

doc/cookbook/wordpress.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Integrate Infinite AJAX Scroll with Wordpress
2+
=============================================
3+
4+
In this cookbook we install Infinite AJAX Scroll into the default Twenty Twelve theme.
5+
6+
1) Download [jquery-ias.min.js](download.html).
7+
8+
2) Place jquery-ias.min.js into the folder `wp-content/themes/twentytwelve/js`
9+
10+
3) Open `wp-content/themes/twentytwelve/header.php` in your editor
11+
12+
4) Add jQuery to the theme. Paste the following code before the line with "`</head>`":
13+
14+
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
15+
16+
5) Paste the following code before the line with "`</head>`":
17+
18+
<script src="<?php echo get_template_directory_uri(); ?>/js/jquery-ias.min.js" type="text/javascript"></script>
19+
20+
6) Now page the following code before the line with "`</head>`":
21+
22+
<script type="text/javascript">
23+
var ias = $.ias({
24+
container: "#content",
25+
item: ".post",
26+
pagination: ".navigation",
27+
next: ".nav-previous a",
28+
});
29+
30+
ias.extension(new IASTriggerExtension({offset: 2}));
31+
ias.extension(new IASSpinnerExtension());
32+
ias.extension(new IASNoneLeftExtension());
33+
</script>
34+
35+
Done. Happy scrolling!

doc/getting-started.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ var ias = jQuery.ias({
4040
Now you have a basic setup of Infinite AJAX Scroll. Time to add some fancy stuff.
4141

4242
```javascript
43-
// Adds a link which has to be clicked to load the next page
44-
ias.extension(new IASTriggerExtension());
45-
46-
// Adds a loader image which is displayed during loading
43+
// Add a loader image which is displayed during loading
4744
ias.extension(new IASSpinnerExtension());
4845

49-
// Adds a text when there are no more pages left to load
50-
ias.extension(new IASNoneLeftExtension());
46+
// Add a link after page 2 which has to be clicked to load the next page
47+
ias.extension(new IASTriggerExtension({offset: 2}));
48+
49+
// Add a text when there are no more pages left to load
50+
ias.extension(new IASNoneLeftExtension({text: "You reached the end"}));
5151
```

0 commit comments

Comments
 (0)