Bitcoin ticker fontawesome

0 votes

My task was to write a function that gets Bitcoin trades from JSON link, change interval with buttons, add a font awesome arrow up/down/line depending on if the rate went up/down/no change and display it on the website.

I have everything except font awesome...

My HTML code is:

<h3>Bitcoin to PLN</h3> <h4>Buy</h4> <div id="buy"><p></p></div> <h4>Sell</h4> <div id="sell"><p></p></div> <h4>Refresh in:</h4> <form name="timerBtn"> <input type="button" class="button" id="btn5" value="5 s"> <input type="button" class="button" id="btn10" value="10 s"> <input type="button" class="button" id="btn30" value="30 s"> <input type="button" class="button" id="btn60" value="60 s"> </form> <p id="timer">Refreshing in 5 sekund</p>


And the JS code:

$("form").click( function(getTimer) { if (getTimer.target.className === 'button') { $("p#timer").empty(); var timer = $("p#timer").append( "Refresh in " + getTimer.target.value); } return timer }); function startRefresh() { $.getJSON("https://blockchain.info/pl/ticker", function (data) { $("#buy").html(data.PLN.buy); $("#sell").html(data.PLN.sell); console.log ("reupload"); }); } setTimer = setInterval(startRefresh, 5000); $("input#btn5").click( function() { clearInterval(setTimer); setTimer = setInterval(startRefresh, 5000); }); $("input#btn10").click( function() { clearInterval(setTimer); setTimer = setInterval(startRefresh, 10000); }); $("input#btn30").click( function() { clearInterval(setTimer); setTimer = setInterval(startRefresh, 30000); }); $("input#btn60").click( function() { clearInterval(setTimer); setTimer = setInterval(startRefresh, 60000) });


I don't know how to deal with the font awesome part

Thanks in advance for any tips!!

Apr 6 in Blockchain by Rahul
• 8,980 points
44 views

1 answer to this question.

0 votes

Font Awesome arrow up is displayed like this:

<i class="fa fa-arrow-up"></i>

I would store all those HTML snippets into their own variables.

upArrow = '<i class="fa fa-arrow-up"></i>'

And then inject them when you inject the HTML in the startRefresh function like this:

$("#buy").html(upArrow + data.PLN.buy);

answered Apr 12 by Soham
• 8,730 points

Related Questions In Blockchain

0 votes
1 answer

PHP. Bitcoin to Ukrainian Hrivna price ticker

nstead of dividing the values - i ...READ MORE

answered Sep 11, 2018 in Blockchain by slayer
• 29,310 points
367 views
0 votes
1 answer

PHP. Bitcoin to Ukrainian Hrivna price ticker

I would suggest, that instead of dividing ...READ MORE

answered Apr 7 in Blockchain by Aditya
• 7,280 points
27 views
+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,440 points
606 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
918 views
0 votes
1 answer
0 votes
1 answer

SHA256 Hash doesn't match the one listed on Bitcoin Wiki

The problem occurring here is that you ...READ MORE

answered Feb 28 in Blockchain by Soham
• 8,730 points
42 views
0 votes
1 answer

Bitcoin Core on external SSD in OS X

 In order to do so, assuming you ...READ MORE

answered Feb 28 in Blockchain by Soham
• 8,730 points
35 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP