Last active
May 23, 2016 17:25
-
-
Save donoage/e44f314f24314aac6c12e780d89cf4cf to your computer and use it in GitHub Desktop.
This file contains 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 characters
$(document).ready(function() { | |
//.submit() is only for <form> element. | |
// use .click() for .navLinks | |
$(".navLinks").click(function(event) { | |
event.preventDefault(); | |
}); | |
$(".post").click(function(event) { | |
event.preventDefault(); | |
}); | |
$(".readmore").click(function(event) { | |
event.preventDefault(); | |
console.log("prevented!") | |
}); | |
$(".readmore").click(function() { | |
$(".readmore").hide(); | |
$("#show-this-on-click").slideDown("slow"); | |
$(".readmore").hide(); | |
$(".readless").show(); | |
console.log("readmoreallowed") | |
}); | |
$(".readless").click(function() { | |
//check out this line where we pass in another 'anonoymous function' as a parameter for slideUp() | |
// this makes whatever's inside of anonoymous function gets fired AFTER slideUp() animation is done. | |
$("#show-this-on-click").slideUp("slow", function() { | |
$(".readmore").show(); | |
$(".readless").hide(); | |
}); | |
console.log("readlessallowed") | |
}); | |
$(".sideBarLinks").click(function(event) { | |
event.preventDefault(); | |
}); | |
//No need for a seperate click function for event.preventDefault(). | |
//See below. | |
// | |
// | |
// $(".learnmore").click(function(event) { | |
// event.preventDefault(); | |
// }); | |
// $(".learnless").click(function(event) { | |
// event.preventDefault(); | |
// }); | |
$(".learnmore").click(function(event) { | |
event.preventDefault(); | |
$("#learnmoretext").slideDown("slow"); | |
$(".learnmore").hide(); | |
$(".learnless").show(); | |
}); | |
$(".learnless").click(function(event) { | |
event.preventDefault(); | |
$(".learnless").hide(); | |
$(".learnmore").show(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment