Midway.js
Automatically center responsive elements.
Install / Use
/learn @brandonjacoby/Midway.jsREADME
#Midway.js ##Automatically center responsive elements.
Midway.js makes it super easy to automatically center the responsive elements on your websites. You all know and love the absolute positioning centering technique, but what happens when those centered elements change sizes, due to percentage based layouts? That's where Midway.js comes in. Take a look at the example below, and see for yourself!
##Usage
- Place the following right before </head>
<script type="text/javascript" src="midway.min.js"></script>
- Add the class
midway-horizontaland/ormidway-verticalto center vertically, horizontally, or both.
In use:
<div class="midway-horizontal midway"></div>
##Release Notes
###v1.1
- Call the centering function whenever you would like, rather than just on load and resize. Simply call Midway();
- Midway.js now works with all elements, all the time! No more pesky bugs that would cause the element to be uncentered until you resize the browser.
- Other minor bug fixes.
###v1.2
- Fixed bug in which centering breaks with more than one element being centered the same way.
- Classes renamed from
centerVerticaltomidway-verticalandcenterHorizontaltomidway-horizontal. - Small performance improvement.
- Demo file added.
Related Skills
node-connect
350.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
