Vertical and horizontal offset of the Zendesk Web Widget (Classic)

Issue symptoms

After adding the Web Widget (Classic) to my website, I notice that the widget covers other buttons on the page.

Tip:This article details the step for offsetting the Web Widget (Classic).

Resolution steps

Use our API codes to move the widget either vertically or horizontally or both. This is what we call offsetting the button and window from the edge of the browser window or mobile app window. This article will cover how to offset your widget button and widget window from the default position.

Vertical offset

Horizontal offset

Mobile offset

Important: Before you begin, add the widget to your site by embedding the widget script in the HTML source code. Add the window.zESettings customization code before the Web Widget script.

Vertical offset

This API code sets the vertical offset of the chat button from the edge of the browser window:

<script type="text/javascript">
window.zESettings = {
webWidget: {
offset: {
vertical: '50px'
}
}
};
</script>

Change the number inside () depending on your needs.

The default position of the chat button is on the bottom-right corner of the page. Applying the vertical offset code results in the button moving vertically towards the top of the page.

This API code will vertically offset the chat window together with the chat button:

$zopim.livechat.window.setOffsetVertical(50);

Change the number inside() depending on your needs.

The default position of the chat window opens from the bottom of the page. After applying the API code, your chat window will now open a specified distance from the bottom of the page.

Horizontal offset

This code moves the Web Widget 50 pixels from the bottom edge of the browser window. Change the value as needed.

<script type="text/javascript">
window.zESettings = {
webWidget: {
offset: {
horizontal: '50px'
}
}
};
</script>

Change the number inside() depending on your needs.

Applying the horizontal offset button code results in the button moving horizontally towards the left side of the page.

This API code will horizontally offset the chat window:

$zopim.livechat.window.setOffsetHorizontal(50);

Change the number inside() depending on your needs.

Applying the horizontal offset window code results in the window moving horizontally towards the left side of the page:

Mobile offset

Offset for the mobile chat button and window using the API codes below:

<script type="text/javascript">
window.zESettings = {
webWidget: {
offset: {
mobile: {
vertical: '30px',
horizontal: '30px'
}
}
}
};
</script>

Change the number inside () depending on your needs.

For more information, see this article: Javascript API.