HubSpot CMS

Call to action 6

Action Module Code This module allows to set up a basic action button, encouraging visitors to click on the button. This module includes link, button, text and background settings.

Unverified
?

After receiving a minimum of 25 recommendations, an entry earns the "Community Approved" badge.

Please keep in mind, all entries are community created and may not be fully supported by HubSpot.

0 Recommendations

View on:

GitHub

HTML + HUBL


{{ require_css("//cdn2.hubspot.net/hubfs/346178/designmodo/ui-kit/ui-kit-content/css/ui-kit-styles.css") }}      
<!-- content-11 -->
<section class="content-11" style="background-color: {{ module.background_color.color }};">
    <div class="container">
        <span style="color: {{ module.text_color.color }};">{{ module.text }}</span> 
      	
      	{% if module.choose_cta_button %}
      		<div class="btn-cta">{% cta guid="{{ module.cta_button }}" %}</div>
        {% else %}
      	  {% set styles = 'background-color: {{ module.button.button_color.color }}; color: #ffffff;' %}
          {% set link = page_by_id(module.button.link).absolute_url if module.button.link else "#" %}

          {% if module.button.use_custom_link %}
              {% set link = module.button.custom_link %}
          {% endif %}

          {% if module.button.button_type == 'clear' %}
              {% set styles = 'background-color: transparent; border: 2px solid {{ module.button.button_color.color }}; color: {{ module.button.button_color.color }};' %}
          {% endif %}

          {% if link %}
          <a class="btn btn-large js-btn-color" href="{{ link }}" style="{{ styles }}" data-btn-type="{{ module.button.button_type }}" data-btn-color="{{ module.button.button_color.color }}" data-btn-hover-color="{{ module.button.button_hover_color.color }}">{{ module.button.button_text }}</a>
          {% endif %}
        {% endif %}
    </div>
</section>

          
        
CSS
          
            .btn-cta {
	display: inline-block;
  margin-left: 33px;
}

@media (max-width: 614px) {
	.btn-cta {
  	margin: 30px 0 0;
  }
}

          
        
JS
          
            jQuery(document).ready(function($) {
    $(".content-11").each(function() {
        var o = $(this);
        if (o.hasClass("init")) {
            return;
        }
        o.addClass("init");
      
      	var style = "";

        o.find(".js-btn-color").each(function(){
            var btnType = $(this).data('btn-type');
            var btnColor = $(this).data('btn-color');
            var btnHoverColor = $(this).data('btn-hover-color');
            
            var btnId = "id-" + Math.random().toString().slice(2);
            $(this).attr("id", btnId);

            $(this).removeAttr('style');

             if(btnType === 'normal') {
                style += "#" + btnId + ".btn { background-color: " + btnColor + "; color: #ffffff; } \n";
                style += "#" + btnId + ".btn:hover, #" + btnId + ".btn:focus, #" + btnId + ".btn:active { background-color: " + btnHoverColor + "; } \n";
            }

            if(btnType === 'clear') {
                style += "#" + btnId + ".btn { background-color: transparent; border: 2px solid " + btnColor + "; color: " + btnColor + "; } \n";
                style += "#" + btnId + ".btn:hover, #" + btnId + ".btn:focus, #" + btnId + ".btn:active { background-color: " + btnColor + "; color: #ffffff; } \n";
            }
        });

        $("<style type='text/css'/>").html(style).appendTo("head");
    });
});

          
        
Have Questions?

Ask technical questions in Slack.

HubSpot Developer Slack

Not a member yet? - join here
READ ME (VIEW IN GITHUB)

HubSpot

Call to Action 6

This module allows to set up a basic action button, encouraging visitors to click on the button. This module includes link, button, text and background settings.

Call to Action 6 module demo can be visited here:

w.inboundlabs.co/action6-content5-demo

Call to Action 6 module is FREE and is part of the Startup Framework FREE and PAID packages:

https://marketplace.hubspot.com/products/inboundlabs/startup-framework-marketplace

Have Questions?

If you have questions, please email me at github (at) inboundlabs.co


HubSpot

Not developing on HubSpot CMS yet?

We'd love to have you a part of our developer community!

 
0 Recommendations

Other Open Source Projects

Browse all other open source projects

CrankShaft Framework

A modern framework for accelerating build times on the HubSpot CMS. Based on a modified Bootstrap 4 framework.

Lead developers: Jon McLaren

Developer Chrome Extension

Chrome/Chromium extension for HubSpot CMS Developers that adds a developer menu, dark theme and useful shortcuts to commonly used HubSpot query parameters, resources, and tools for making HubSpot Development easier and more enjoyable.

Lead developers: Jon McLaren , William Spiro , Gonzalo Torreras

VS Code HubL Language Extension

This extension enables super fast local development of CMS pages, and is a great compliment to using the new local HubL server. It contains comprehensive HubL tag, function, filter and expression test auto-complete snippets, as well as their documentation.

Lead developers: William Spiro

Not coding on HubSpot CMS yet?

We invite you to explore why thousands of developers LOVE coding with HubSpot!

Contribute
Made with  by community members: InboundLabs.co