Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function (){
- $("#dates > li").click(function (){
- getData($(this).text())
- })
- let index = 0;
- function getData(date){
- $("#strips").empty()
- $.ajax({
- url: "https://cors-anywhere.herokuapp.com/https://api.shortboxed.com/comics/v1/release_date/"+date,
- dataType: "json",
- success: function (data){
- $.each(data.comics, function (i, item){
- list_item = $("<li></li>")
- list_item.append("Title: " + item.title + " ;Price: " + item.price)
- list_item.attr("desc", item.description)
- list_item.attr("creators", item.creators)
- list_item.attr("index", index++)
- list_item.attr("clicked", "0")
- list_item.appendTo("#strips")
- })
- }
- })
- }
- $(document).on("click", "#strips > li", function (){
- if($(this).attr("clicked") === "0") {
- $(this).append("<div id=" + $(this).attr('index') + "></div>")
- $(this).attr("clicked", "1")
- $("#" + $(this).attr("index")).html("Description: " + $(this).attr("desc") + " \nCreators: " + $(this).attr("desc"))
- $("#" + $(this).attr("index")).append("<br><a href='http://www.delicious.com/'><img src='images/delicious.png'</a><a href='http://www.digg.com/'><img src='images/digg.png'</a><a href='http://www.facebook.com/'><img src='images/facebook.png'</a><a href='http://www.flickr.com/'><img src='images/flickr.png'</a><a href='http://www.linkedin.com/'><img src='images/linkedin.png'</a><a href='http://www.reddit.com/'><img src='images/reddit.png'</a><a href='http://www.twitter.com/'><img src='images/twitter.png'</a>")
- } else{
- $(this).attr("clicked", "0")
- $("#" + $(this).attr('index')).empty()
- }
- // $("#info").hide()
- // $("#desc").html($(this).attr("desc"))
- // $("#creators").html($(this).attr("creators"))
- // $("#info").appendTo($(this))
- // $("#info").show()
- })
- })
Add Comment
Please, Sign In to add comment