π¦ BOX NOW Widget Example 4
This page demonstrates how to integrate the BOX NOW Locker selection map widget with autoshow: true and autoclose: false.
This example has no buttonβthe widget appears automatically!
π‘ Tip:
You can copy, customize, and use this example in your own project!
π Try the Live Demoβ
π Open the Live Demo
The demo opens in a new tab so you can test the map widget in a real environment!
π Demo Source Codeβ
Below is the full HTML source code for the demo page.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>BOX NOW Widget Example 4</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
html,
body {
height: 100%;
margin: 0;
padding: 0;
background: #e6e9ec;
font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
color: #222;
width: 100vw;
min-height: 100vh;
}
body {
min-height: 100vh;
min-width: 100vw;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
h1 {
color: #444b44;
font-size: 2.2rem;
margin: 40px 0 10px 0;
text-align: center;
font-weight: 700;
}
.sub {
color: #586069;
font-size: 1.15rem;
text-align: center;
margin-bottom: 30px;
}
#boxnowmap {
width: 82vw;
max-width: 1700px;
min-width: 270px;
height: 64vh;
min-height: 260px;
max-height: 820px;
border-radius: 13px;
border: 1.5px solid #d2e3fa;
background: #fafdff;
box-shadow: 0 1.5px 8px 0 rgba(13, 110, 253, 0.07);
margin: 0 0 28px 0;
display: block;
transition: width 0.25s, height 0.25s;
}
.fields-row {
display: flex;
gap: 28px;
justify-content: center;
flex-wrap: wrap;
margin-bottom: 30px;
}
.input-group {
display: flex;
flex-direction: column;
align-items: flex-start;
min-width: 140px;
flex: 1;
margin-bottom: 12px;
}
.input-group label {
margin-bottom: 4px;
color: #6c757d;
font-weight: 500;
font-size: 1rem;
}
.input-group input {
width: 100%;
padding: 9px 10px;
font-size: 1.07rem;
border: 1.2px solid #d0d7de;
border-radius: 6px;
background: #fff;
transition: border 0.13s;
}
.input-group input:focus {
border: 1.2px solid #44d62d;
outline: none;
}
@media (max-width: 900px) {
#boxnowmap {
width: 98vw;
height: 80vw;
max-width: 100vw;
}
.fields-row {
gap: 11vw;
}
}
@media (max-width: 600px) {
h1 {
font-size: 1.01rem;
margin-top: 20px;
}
.sub {
font-size: 0.97rem;
}
#boxnowmap {
width: 99vw;
height: 80vw;
min-height: 120px;
}
.fields-row {
gap: 5vw;
}
}
@media (max-width: 450px) {
#boxnowmap {
height: 350px;
}
.fields-row {
flex-direction: column;
gap: 7px;
align-items: stretch;
}
.input-group {
min-width: 0;
}
}
</style>
</head>
<body>
<h1>BOX NOW Widget Example 4</h1>
<div class="sub">
This example uses <code>autoclose: false</code> and
<code>autoshow: true</code>.<br />
The widget opens automatically (no button).
</div>
<div id="boxnowmap"></div>
<div class="fields-row">
<div class="input-group">
<label for="example4_zip">ZIP</label>
<input id="example4_zip" value="" readonly />
</div>
<div class="input-group">
<label for="example4_address">Address</label>
<input id="example4_address" value="" readonly />
</div>
<div class="input-group">
<label for="example4_id">ID</label>
<input id="example4_id" value="" readonly />
</div>
</div>
<script type="text/javascript">
function delete4() {
if (document.querySelector('iframe'))
document.querySelector('iframe').remove()
document.getElementById('example4_zip').value = ''
document.getElementById('example4_address').value = ''
document.getElementById('example4_id').value = ''
}
var _bn_map_widget_config = {
autoclose: false,
autoshow: true,
partnerId: 123,
parentElement: '#boxnowmap',
afterSelect: function (selected) {
document.getElementById('example4_zip').value =
selected.boxnowLockerPostalCode
document.getElementById('example4_address').value =
selected.boxnowLockerAddressLine1
document.getElementById('example4_id').value = selected.boxnowLockerId
},
}
;(function (d) {
var e = d.createElement('script')
e.src = 'https://widget-cdn.boxnow.gr/map-widget/client/v5.js'
e.async = true
e.defer = true
d.getElementsByTagName('head')[0].appendChild(e)
})(document)
</script>
</body>
</html>