Mar 6, 2020
White Arrow icon
Back to all Elements

Contact form as a Chat widget

A contact form disguised as a chat widget.

This small cloneable project is 90% webflow native NoCode elements. The only code part here is the 'click outside to close' thingy...
Basically a few lines of code to  close the widget whenever the user is clicking anywhere else on the page.

So, we start by adding the toggle animation for opening and closing the widget when clicking the Chat icon:

<script>
$('.email-widget-icon').click(function() {
 $('.email-widget-form-block').toggleClass('open-widget');
})
</script>

Copy

And of-course the relevant class (which can be also created in Webflow, but then there's the possibility of deleting it when performing a cleanup):

<style>
.open-widget {
transform: scale(1);
 Opacity: 1;
}
</style>

Copy

And lastly we add the 'click-outside-to-close' part, which checks if our mouse pointer is inside or outside the widget:

<script>
$(document).mouseup(function(e)
{
   var container = $(".email-widget-wrap");

   if (!container.is(e.target) && container.has(e.target).length === 0)
   {
       $(".email-widget-form-block").removeClass('open-widget');
   }
});
</script>

Copy

Preview:

Share:

Whenever possible, use Class Names to target the elements in your interaction. You never know when you'll need to duplicate and use it somewhere else...

Might also interest you:

3d Video Slider (swiper.js)

Cloneable
CMS
JavaScript

A 3d slider with video items, plays and pauses on click & slide change.

Read more
White Arrow icon

Webflow Dashboard Workspaces Hack

Webflow UI Hack
Code
CSS

Convert the Workspaces dropdown to an open sidebar with custom order.

Read more
White Arrow icon

Glossary

Cloneable
JavaScript
CMS

A clonable for creating an Alphabetical glossary

Read more
White Arrow icon