Skip to content

Instantly share code, notes, and snippets.

@razass
Created October 1, 2010 01:01
Show Gist options
  • Save razass/605565 to your computer and use it in GitHub Desktop.
Save razass/605565 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>lucenbills test</test>
<script type="text/javascript" charset="utf-8" src="http://yui.yahooapis.com/3.2.0/build/yui/yui-min.js"></script>
<style type="text/css">
#image {
width: 300px;
height: 300px;
background-color: grey;
position: relative;
}
.img_1 {
background-image: url('1.png');
width: 300px;
height: 300px;
}
.img_2 {
background-image: url('2.png');
width: 300px;
height: 300px;
}
.img_3 {
background-image: url('3.png');
display: none;
width: 300px;
height: 300px;
float: left;
}
</style>
</head>
<body>
<script>
YUI().use('node', 'event', function(Y) {
Y.one('#btn').on('click', function(e) {
var swp = Y.one('#swap');
swp.addClass('img_2');
swp.removeClass('img_1');
});
});
</script>
<div id="image">
<div id="swap" class="img_1"></div>
<button id='btn'>Click</Button>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment