//All images in this app come from Code.organd are //Creative Commons free to use var namesList = getColumn("100 Birds of the World", "Name"); var colorsList = getColumn("100 Birds of the World", "Primary Color"); var birdImageList = getColumn("100 Birds of the World", "Image of Bird"); var index = 0; //Filtered Lists var filternameList = []; var filterbirdImageList = []; onEvent("colorDropDown", "click", function( ) { var color = getText("colorDropDown"); createFilteredList(color); }); onEvent("leftButton", "click", function( ) { index = index - 1; updatescreen(); }); onEvent("rightButton", "click", function( ) { index = index + 1; updatescreen(); }); function createFilteredList(color) { filterbirdImageList = []; filternameList = []; for (var i = 0; i < colorsList.length; i++) { if (color == colorsList[i]) { appendItem(filterbirdImageList, birdImageList[i]); appendItem(filternameList, namesList[i]); } } console.log(filternameList); updatescreen(); } function updatescreen(){ if (index > 0 && index < filternameList.length){ setImageURL("birdImage", filterbirdImageList[index]); setText("nameLabel", filternameList[index]); } else { index = 0; setImageURL("birdImage", filterbirdImageList[index]); setText("nameLabel", filternameList[index]); } } //forgot to call the function "updatescreen"
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter