Skip to content

Instantly share code, notes, and snippets.

@schickm
Created April 30, 2014 23:38
Show Gist options
  • Save schickm/270ecbd3f1a508737d6a to your computer and use it in GitHub Desktop.
Save schickm/270ecbd3f1a508737d6a to your computer and use it in GitHub Desktop.
jQuery: changing up the css
<article>
<h2>Yet another headline</h2>
<a class="read-more" href="#">read more...</a>
<div class="more">
<p>Another tasty story...</p>
</div>
</article>
<article>
<h2>Even another headline!!!!</h2>
<a class="read-more" href="#">read more...</a>
<div class="more">
<p>This story is flippin amazin.</p>
</div>
</article>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script type="text/javascript">
$('.read-more').on('click', function() {
$(this).closest('article').find('.more').slideDown();
return false;
});
$('h2').on('mouseover', function() {
$(this).closest('article').find('.read-more').css({'font-size': '16px'});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment