1
+ <!DOCTYPE>
2
+ < html >
3
+ < head >
4
+ < meta http-equiv ="Content-Type " content ="text/html; charset=UTF-8 ">
5
+ < title > Insert title here</ title >
6
+ < script type ="text/javascript " src ="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js "> </ script >
7
+ < script type ="text/javascript " src ="pinmarklet.js "> </ script >
8
+ </ head >
9
+
10
+ < body >
11
+ < p > Photo gallery</ p >
12
+ < ul >
13
+ < li style ="display: inline; "> < img src ="https://lh6.ggpht.com/oJ-bWH2rXcm4OozwnAxatnyBMIjbNDGtZtmvvzTgwzz7gYUI4Rm1_U7uUS0Q5xCMOj8=w124 " alt ="Shape'd image " /> </ li >
14
+ < li style ="display: inline; "> < img src ="https://lh6.ggpht.com/_lTfuXOfXmr6ltzuSnKKMJ7sgTYcxAAsrRZOXUHnm3-ANUTIPvYoEo2De04LV95jDqc=h230 " /> </ li >
15
+ < li style ="display: inline; "> < img src ="https://lh6.ggpht.com/cJc0ziefWgLEFzqftXVfwHpsj7xgQYDfuvJAKEGVBS34FA_UVlXieDKTFy-2KxYNAEM=h230 " /> </ li >
16
+ < li style ="display: inline; "> < img src ="https://lh5.ggpht.com/PsBg95GrXk3fgywMSYQ01efNDLyQ87vjV4d12Be03975CU5a5VCuC1fDdHxueAIWc-w=h230 " /> </ li >
17
+ </ ul >
18
+
19
+
20
+ < p > Having these images usually we will want to just share the first and second images, so we can pass these images to the function</ p >
21
+ < p > On the event onClick when share with Pinterest the image there is a function that print in console</ p >
22
+
23
+ < a id ="pinterest " href ="# "> < img src ="images/PinExt.png "> </ a >
24
+ < script type ="text/javascript ">
25
+ //map the object to a default img
26
+ $ ( "#pinterest" ) . click ( function ( ) {
27
+ var imgArray = {
28
+ images : [
29
+ {
30
+ src : "https://lh6.ggpht.com/oJ-bWH2rXcm4OozwnAxatnyBMIjbNDGtZtmvvzTgwzz7gYUI4Rm1_U7uUS0Q5xCMOj8=w124" ,
31
+ alt : "Image from Google Images"
32
+ } ,
33
+ {
34
+ src : "https://lh6.ggpht.com/_lTfuXOfXmr6ltzuSnKKMJ7sgTYcxAAsrRZOXUHnm3-ANUTIPvYoEo2De04LV95jDqc=h230" ,
35
+ alt : "Image from Google Images"
36
+ }
37
+ ]
38
+ } ;
39
+
40
+ UTIL . pinterest . addPinMarklet ( {
41
+ images : imgArray . images ,
42
+ onPin : function ( ) {
43
+ console . log ( "onPin event you can execute whatever you need" ) ;
44
+ }
45
+ } ) ;
46
+ return false ;
47
+ } ) ;
48
+ </ script >
49
+ </ body >
50
+ </ html >
0 commit comments