Hi, everyone. As a matter of fact. If you click the button in Javascript, I went from right to leftI'm going to make a side bar that comes out.
I made a side bar on the right I can't implement the function that goes in and out when I click the button.
I didn't know the basics of Javascript and just came at you to make a homepage. I understand html css. I have no idea about java.
Are there any masters who can help you?ㅠ<
javascript slide sidebar
jQuery
's .toggleClass() is simple.
If you are familiar with css
,
transition: right 0.5s ease;
Simple animations are also easy to handle, as shown in .
<div class="l-container">
<div class="l-contents">
<p>I'm Contents</p>
</div>
<div class="l-sidebar is-close">
<div class="sidebar-in">
<p>I'm Sidebar</p>
<button type="button" class="btn-toggle">OPEN</button>
</div>
</div>
</div>
.l-container {
position: relative;
}
.l-container .l-sidebar {
position: fixed;
right: 0;
top: 0;
width: 200px;
height: 100%;
border-left: 1px solid #ccc;
transition: right 0.5s ease;
}
.l-container .l-sidebar.is-close {
right: -200px;
transition: right 0.5s ease;
}
.l-container .l-sidebar .sidebar-in {
position: relative;
width: 180px;
margin: 0 auto;
}
.l-container .l-sidebar .sidebar-in .btn-toggle {
position: absolute;
left: -60px;
top: 10px;
width: 50px;
background: #000;
color: #fff;
display: inline-block;
padding: 10px 0;
}
;(function($){
var $btnToggle = $('.btn-toggle'),
$sideBar = $('.l-sidebar');
$btnToggle.on('click', function(e){
var _this = $(this);
$sideBar.toggleClass('is-close');
if($sideBar.hasClass('is-close')) {
_this.text('open');
} } else {
_this.text('close');
}
});
})(jQuery);
Hmm? The code pen embed doesn't work.
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
578 Understanding How to Configure Google API Key
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.