Created
October 3, 2011 21:29
-
-
Save mediaupstream/1260308 to your computer and use it in GitHub Desktop.
Revisions
-
mediaupstream revised this gist
Oct 3, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,7 +27,7 @@ function loadImages (url, container){ $(container).append(slide); }); // initialize anythingSlider $(container).anythingSlider(); } }); }; -
mediaupstream revised this gist
Oct 3, 2011 . 1 changed file with 4 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,9 +3,9 @@ */ { "images": [ {"title": "Image One", "url": "image1.jpg", "rating": "3.5"}, {"title": "Image Two", "url": "image2.jpg", "rating": "1"}, {"title": "Image Three", "url": "image3.jpg", "rating": "5"} ] } @@ -22,8 +22,7 @@ function loadImages (url, container){ $.getJSON(url, function(data){ if(typeof data === 'object'){ // create the HTML markup for the slider from data $.each(data['images'], function(key, image){ var slide = '<li><img src="'+image['url']+'" alt="'+image['title']+'"></li>'; $(container).append(slide); }); -
mediaupstream revised this gist
Oct 3, 2011 . 1 changed file with 23 additions and 23 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,11 +2,11 @@ * file: images.json */ { "images": [ [{"title": "Image One", "url": "image1.jpg", "rating": "3.5"}], [{"title": "Image Two", "url": "image2.jpg", "rating": "1"}], [{"title": "Image Three", "url": "image3.jpg", "rating": "5"}] ] } @@ -18,23 +18,23 @@ */ function loadImages (url, container){ // get the JSON object $.getJSON(url, function(data){ if(typeof data === 'object'){ // create the HTML markup for the slider from data $.each(data['images'], function(key, val){ var image = val[0]; var slide = '<li><img src="'+image['url']+'" alt="'+image['title']+'"></li>'; $(container).append(slide); }); // initialize anythingSlider $('container').anythingSlider(); } }); }; $(function(){ loadImages('images.json', '#slider1'); }); @@ -45,11 +45,11 @@ $(function(){ */ <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script> <script src="http://proloser.github.com/AnythingSlider/js/jquery.anythingslider.js"></script> <script src="application.js"></script> </head> <body> <ul id="slider1"></ul> </body> </html> -
mediaupstream created this gist
Oct 3, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,55 @@ /** * file: images.json */ { "images": [ [{"title": "Image One", "url": "image1.jpg", "rating": "3.5"}], [{"title": "Image Two", "url": "image2.jpg", "rating": "1"}], [{"title": "Image Three", "url": "image3.jpg", "rating": "5"}] ] } /** * file: application.js */ function loadImages (url, container){ // get the JSON object $.getJSON(url, function(data){ if(typeof data === 'object'){ // create the HTML markup for the slider from data $.each(data['images'], function(key, val){ var image = val[0]; var slide = '<li><img src="'+image['url']+'" alt="'+image['title']+'"></li>'; $(container).append(slide); }); // initialize anythingSlider $('container').anythingSlider(); } }); }; $(function(){ loadImages('images.json', '#slider1'); }); /** * file: index.html */ <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script> <script src="http://proloser.github.com/AnythingSlider/js/jquery.anythingslider.js"></script> <script src="application.js"></script> </head> <body> <ul id="slider1"></ul> </body> </html>