A Pen by Brian LePore on CodePen.
Last active
October 16, 2015 13:30
-
-
Save powrsurg/649d4ed613a87254f2a2 to your computer and use it in GitHub Desktop.
YyEzYj
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
<div id="container" tabindex="-1" aria-live="assertive"> | |
<div id="slide_title" data-title="1">Test 1</div> | |
<img id="slide_img" src="http://gravatar.com/avatar/d656c4ab1e862ddb258d6250e980ab47?s=80" alt="Brian's avatar" /> | |
<button type="button" id="next">Next Page</button> | |
</div> |
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() { | |
$("#next").click(function() { | |
if ($("#slide_title").attr('data-title') == 1) { | |
$("#slide_title").text("Test 2").attr('data-title', 2); | |
$("#slide_img").attr("src", "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png").attr("alt", "Google logo"); | |
} else { | |
$("#slide_title").text("Test 1").attr('data-title', 1); | |
$("#slide_img").attr("src", "http://gravatar.com/avatar/d656c4ab1e862ddb258d6250e980ab47?s=80").attr("alt", "Brian's avatar"); | |
} | |
$("#container").focus(); | |
}); | |
}); |
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
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> |
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
#slide_img { display:block; } | |
#next { margin-top: 10px; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment