/ Published in: JavaScript
Expand |
Embed | Plain Text
window.addEvent('domready', function() { //inject div var el = new Element('div', { 'id': 'coupon', 'class': 'closed', 'text': ' ' }).inject(document.body); //settings var state = 'closed'; //add the click toggle el.addEvent('click', function() { //change the state state = (state == 'closed' ? 'open' : 'closed'); el.morph('.' + state); }); }); <style type="text/css"> #coupon { top:0; right:100px; position:absolute; cursor:pointer; width:585px; background:url(http://davidwalsh.name/dw-content/slider-coupon.png) 0 bottom no-repeat; } .closed { height:29px; } .open { height:176px; } </style>
Comments
Subscribe to comments
You need to login to post a comment.

Is this based off of any particular framework (jQuery, Script.aculo.us, Mootools, Etcetera) or is it a simple standalone?