|
1 | 1 | # Imitation_FB_Suggestion-Box
|
2 |
| -Imitating the UI of FB's About Page section which presents TV ,Movies or Music suggestions. |
| 2 | + |
| 3 | +This is a plugin mainly depends on jQuery ,Imitating the UI of FB's About Page section which presents TV ,Movies or Music suggestions. |
| 4 | + |
| 5 | +## Prerequisities |
| 6 | + |
| 7 | +Make sure that jQuery library and needed files was included . |
| 8 | + |
| 9 | +```html |
| 10 | +<link rel="stylesheet" type="text/css" href="css/Imitation_FBSB.css"> |
| 11 | +<script src="js/jquery-1.11.2.min.js"></script> |
| 12 | +<script src="js/Imitation_FBSB.js"></script> |
| 13 | +``` |
3 | 14 |
|
4 | 15 | [Demo](http://carr1005.github.io/)
|
| 16 | +## Usage |
| 17 | + |
| 18 | + |
| 19 | +###HTML |
| 20 | +The essential HTML pattern to generate slide box . |
| 21 | +The id of the outmost div is the key to trig plugin . |
| 22 | + |
| 23 | +```html |
| 24 | +<div class ='box' id="name_it"> |
| 25 | + <h3></h3> |
| 26 | + <div class='tri'></div> |
| 27 | + <div class ='slide-wrap'> |
| 28 | + <div class='border'> |
| 29 | + <div class='slide'> |
| 30 | + <div class='shift right'></div> |
| 31 | + <i class='shift right'></i> |
| 32 | + <div class='shift left'></div> |
| 33 | + <i class ='shift left'></i> |
| 34 | + <ul> |
| 35 | + <li> |
| 36 | + </li> |
| 37 | + <li> |
| 38 | + </li> |
| 39 | + </ul> |
| 40 | + </div> |
| 41 | + </div> |
| 42 | + </div> |
| 43 | +</div> |
| 44 | +``` |
| 45 | + |
| 46 | +###javascript&jQuery |
| 47 | +There are several ways to generate initial setting . |
| 48 | +```html |
| 49 | +<script> |
| 50 | +
|
| 51 | + $(function(){ |
| 52 | +//--------------------------------------------------------1. |
| 53 | + $.getJSON("JSON/data.js",function (result){ |
| 54 | + var setting = { |
| 55 | + subject:'Subject', //subject would be the theme of the slide box . |
| 56 | + cardw : 145, //page card's width . |
| 57 | + cardh : 217, //page card's hieght . |
| 58 | + cardn : 5, //the number of visible page card . |
| 59 | + margin : 9, //margin between cards . |
| 60 | + JSON :result //prepare the JSON file . |
| 61 | + }; |
| 62 | + $('#id').FBSB(setting); |
| 63 | + }); |
| 64 | +//--------------------------------------------------------2. |
| 65 | + var setting2 = { |
| 66 | + subject:'Subject', |
| 67 | + cardw : 145, |
| 68 | + cardh : 217, |
| 69 | + cardn : 5, |
| 70 | + margin : 9, |
| 71 | + JSON :result |
| 72 | + }; |
| 73 | + |
| 74 | + $.getJSON("JSON/data.js",function (result){ |
| 75 | + setting2.JSON = result; |
| 76 | + $('#id').FBSB(setting2); |
| 77 | + }); |
| 78 | +//--------------------------------------------------------3. |
| 79 | + $.getJSON("JSON/data.js",function (result){ |
| 80 | + $('#id').FBSB({ |
| 81 | + subject:'Subject', |
| 82 | + cardw : 145, |
| 83 | + cardh : 217, |
| 84 | + cardn : 5, |
| 85 | + margin : 9, |
| 86 | + JSON :result |
| 87 | + }); |
| 88 | + }); |
| 89 | +
|
| 90 | + }); |
| 91 | +
|
| 92 | +</script> |
| 93 | +``` |
| 94 | +###JSON |
| 95 | +Adding image , title , descriptopn that you wanna to present in slide box . |
| 96 | + |
| 97 | +Pattern in JSON file would look like this: |
| 98 | +```html |
| 99 | +{ |
| 100 | + //notice! the "Subject" need to be same as specified in initial setting . |
| 101 | + "Subject":[ |
| 102 | + { |
| 103 | + "title":"Gin", |
| 104 | + "des":"1988", |
| 105 | + "imgpath":"path/to/image.jpg" |
| 106 | + }, |
| 107 | + { |
| 108 | + "title":"Brandy", |
| 109 | + "des":"1977", |
| 110 | + "imgpath":"path/to/image.jpg" |
| 111 | + }, |
| 112 | + ... |
| 113 | + ] |
| 114 | +} |
| 115 | +``` |
0 commit comments