Built for Drupal 8, which is end of life. No further development is planned.

Introduction

Use this modul to render content in a sticky popup with button open close
An example is render simple html or text in a sticky area.

Using it by code if possibile render custom form or your custom code

Installation

To correctly install the Vsauce Sticky Popup module it is necessary:

  • launch the command:
    composer require drupal/vsauce_sticky_popup
  • enable the module in the appropriate screen.

Usage

  • 1) Default configuration

    Specify default apparence of sticky popup, in this area, you have an option to display path id, use this option to display this information.
  • 2) Add item by config entity,

    Is possible define new item by config and show it in specific page by path id

Usage by code

This module provide an api to add custom item by code, example: form, block, node, or other html content and trigger open close by javascript.

// Service sticky popup manager.
  $vsp = \Drupal::service('vsauce_sticky_popup.vsauce_sticky_popup_manager_controller');

// Get instance.
  $vsp->getInstance();

// Get empty item.
 $item = $vsp->getEmptyItem();
 
// Define params to new items.
 $item['position_sticky_popup'] = 'right';
 $item['content']['id'] = 1;
 $item['content']['content'] = 1;
 
// Add new item to body.
 $vsp->addItems($item);


Trigger open/close Vsauce Sticky Popup by behaviors

Element is .vsp-button.js-button selector in vsp-wrapper.

// Trigger
 Drupal.behaviors.vsauceStickyPopup.triggerVSP(element);

// Close
Drupal.behaviors.vsauceStickyPopup.triggerVSP(element,'close');

// Open
Drupal.behaviors.vsauceStickyPopup.triggerVSP(element,'open');


Version

Supporting organizations: 

Project information

Releases