File tree Expand file tree Collapse file tree 2 files changed +41
-6
lines changed Expand file tree Collapse file tree 2 files changed +41
-6
lines changed Original file line number Diff line number Diff line change
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!
Original file line number Diff line number Diff line change @@ -40,12 +40,12 @@ var ias = jQuery.ias({
40
40
Now you have a basic setup of Infinite AJAX Scroll. Time to add some fancy stuff.
41
41
42
42
``` 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
47
44
ias .extension (new IASSpinnerExtension ());
48
45
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" }));
51
51
```
You can’t perform that action at this time.
0 commit comments