Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions animations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
$(document).ready(function(){
$('#tweet-controls').hide();

$('.tweet-compose').on('click', function(){
$('#tweet-controls').show();
$(this).height(40);
});



$(".tweet-compose").on("keydown", function() { var count = 140-$(this).val().length;
$('#char-count').text(count)
if(count <= 10){
$('#char-count').css("color" , "red");
}
if(count > 10){
$("#char-count").css("color", "#999");
}
if(count < 0){
$("#tweet-submit").attr('disabled', "disabled");
}
if(count >= 0 ){
$("#tweet-submit").removeAttr("disabled");
}
});


$("#tweet-submit").on("click", function() {


var tweetText = $("textarea.tweet-compose").val();
$("textarea.tweet-compose").val("");
var date = new Date();
var newTweet = $(".tweet:first-of-type").clone();



newTweet.find("p.tweet-text").text(tweetText);
newTweet.find("img.avatar").attr("src", "https://orig15.deviantart.net/5470/f/2010/105/4/5/random_person_by_vurtov.jpg");
newTweet.find(".username").text("@russellwright");
newTweet.find(".fullname").text("Buckks");
newTweet.find(".time").text(date);
newTweet.find(".num-retweets, .num-favorites").text("0");
newTweet.fadeIn();



$("#stream").prepend(newTweet);
$("#char-count").text("140");
$("#char-count").css("color", "#999");

});





$('#stream').on('mouseenter','.tweet', function(){

$(this).find('.tweet-actions').css('display','block');

});




// Tweet Actions, hide on mouseleave
$('#stream').on('mouseleave','.tweet', function(){

$(this).find('.tweet-actions').css('display','none');

});







$('#stream').on('click','.tweet', function(){

$(this).find('.stats').fadeIn();

});








});
4 changes: 4 additions & 0 deletions css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ body {
border: 1px solid #019ad2;
cursor: pointer;
border-radius: 4px;

}
.button:disabled {
color: #777;
Expand Down Expand Up @@ -126,9 +127,11 @@ body {
border-radius: 3px;
margin-bottom: 1em;
box-sizing: border-box;

}
#tweet-controls {
text-align: right;

}
#tweet-controls div {
display: inline-block;
Expand All @@ -137,6 +140,7 @@ body {
font-size: 14px;
color: #999;
text-shadow: 0 1px 1px rgba(255,255,255,.75);

}

/* TWEET */
Expand Down
8 changes: 6 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<div id="dashboard">
<div id="profile-summary">
<div class="content">
<img class='avatar' src='img/alagoon.jpg' />
<p>Your Name Here</p>
<img class='avatar' src='https://orig15.deviantart.net/5470/f/2010/105/4/5/random_person_by_vurtov.jpg' />
<p>Russell Buck</p>
</div>
</div>
<div id="tweet-content">
Expand Down Expand Up @@ -178,5 +178,9 @@ <h2>Tweets</h2>
</div><!-- #stream -->
</div><!-- #main -->
</div><!-- #page-container -->


<script src="./js/jquery-2.0.3.min.js"></script>
<script src="animations.js"></script>
</body>
</html>