Created
September 16, 2014 18:01
-
-
Save Microsofttechies/d0d5cc04d9b991b15f39 to your computer and use it in GitHub Desktop.
slide toggle from right to left and left to right using jquery
This file contains hidden or 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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>slide demo</title> | |
| <link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css"> | |
| <style> | |
| #toggle | |
| { | |
| width: 900px; | |
| height: 30px; | |
| background: #ccc; | |
| } | |
| </style> | |
| <script src="//code.jquery.com/jquery-1.10.2.js"></script> | |
| <script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script> | |
| </head> | |
| <body> | |
| <div id="toggle" style="width: 900px; padding-top: 10px;"> | |
| <div style="float: left;">Hello</div> | |
| <div style="padding-right: 20px; float: right;"> | |
| <div id="close" style="cursor: pointer"><</div> | |
| <div id="open" style="display: none; cursor: pointer">></div> | |
| </div> | |
| </div> | |
| <script> | |
| $("#close").click((function () { | |
| return function () { | |
| $("#close").hide(); | |
| $("#open").show(); | |
| $("#toggle").animate({ | |
| width: "100px" | |
| }, 10); | |
| } | |
| })()); | |
| $("#open").click((function () { | |
| return function () { | |
| $("#close").show(); | |
| $("#open").hide(); | |
| $("#toggle").animate({ | |
| width: "900px" | |
| }, 10); | |
| } | |
| })()); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment