jquery - How can I make an img go out of page when a new div slide in? -
i building new site, in site have navbar menu indicator on left side, logo in middle , possibly other things on right side.
i set jquery action when click on menu indicator new div (the menu) slide in. if surf website pc code doesn't have problems (yet), when open menu mobile img logo won't go out of page (in pc version stays in page because there lot of space), under menu, making weird.
i know can't explain myself well, here jsfiddle.
https://jsfiddle.net/9gx7dzwj/
html
<body> <div id="menu"><ul> <h1>menu</h1> <li>home</li> </ul></div> <div id="navbar"> <div id="menuindicator"></div> <img id="logo" src="http://i.kinja-img.com/gawker-media/image/upload/s--peksmwzm--/c_scale,fl_progressive,q_80,w_800/1414228815325188681.jpg"/> </div> <div id="main"> <!--<h1>asdqe</h1>--> </div> </body>
css
body { width: 500px; margin: 0px; height: 100%; background-color: red; } #navbar { height: 2.5em; background-color: white; margin-top: 0px; width: 100%; } #logo { margin-top: -2.75em; height: 2.5em; display: block; margin-left: auto; margin-right: auto; } #menuindicator { background-color: black; width: 2.5em; height: 2.5em; margin-left: 0; z-index: 1; display: inline-block; } #menuindicator img { margin-top: 0.75em; margin-right: auto; width: 1em; } #menu { background-color: dimgrey; height: 100%; width: 30em; float: left; display: inline; }
js
$(document).ready( function() { $('#menu').hide(); $('#menuindicator').click(function() { $('#menu').toggle("slide"); }); });
everything same wy website, added fixed width simulate mobile environment.
anybody can help?
(there thing that's bugging me, why have set negative top margin logo make stay in navbar?)
thanks in advance!
edit: yes, can solve issue adding negative offset jquery elements in navbar, i'm still interested in why happens
Comments
Post a Comment