<?php
/**
* Class: Jet_Elements_Scroll_Navigation
* Name: Scroll Navigation
* Slug: jet-scroll-navigation
*/
namespace Elementor;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Typography;
use Elementor\Repeater;
use Elementor\Scheme_Color;
use Elementor\Scheme_Typography;
use Elementor\Widget_Base;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Jet_Elements_Scroll_Navigation extends Jet_Elements_Base {
public function get_name() {
return 'jet-scroll-navigation';
}
public function get_title() {
return esc_html__( 'Scroll Navigation', 'jet-elements' );
}
public function get_icon() {
return 'jet-elements-icon-scroll-nav';
}
public function get_jet_help_url() {
return 'https://crocoblock.com/knowledge-base/articles/how-to-use-scroll-navigation-widget-and-apply-scroll-navigation-to-elementor-sections/';
}
public function get_categories() {
return array( 'cherry' );
}
public function get_script_depends() {
return array( 'jet-resize-sensor' );
}
protected function _register_controls() {
$css_scheme = apply_filters(
'jet-elements/scroll-navigation/css-scheme',
array(
'instance' => '.jet-scroll-navigation',
'item' => '.jet-scroll-navigation__item',
'hint' => '.jet-scroll-navigation__item-hint',
'icon' => '.jet-scroll-navigation__icon',
'label' => '.jet-scroll-navigation__label',
'dots' => '.jet-scroll-navigation__dot',
)
);
$this->start_controls_section(
'section_items_data',
array(
'label' => esc_html__( 'Items', 'jet-elements' ),
)
);
$repeater = new Repeater();
$this->_add_advanced_icon_control(
'item_icon',
array(
'label' => esc_html__( 'Hint Icon', 'jet-elements' ),
'type' => Controls_Manager::ICON,
'label_block' => true,
'file' => '',
),
$repeater
);
$this->_add_advanced_icon_control(
'item_dot_icon',
array(
'label' => esc_html__( 'Dot Icon', 'jet-elements' ),
'type' => Controls_Manager::ICON,
'label_block' => true,
'file' => '',
),
$repeater
);
$repeater->add_control(
'item_label',
array(
'label' => esc_html__( 'Label', 'jet-elements' ),
'type' => Controls_Manager::TEXT,
)
);
$repeater->add_control(
'item_section_id',
array(
'label' => esc_html__( 'Section Id', 'jet-elements' ),
'type' => Controls_Manager::TEXT,
)
);
$repeater->add_control(
'item_section_invert',
array(
'label' => esc_html__( 'Invert Under This Section', 'jet-elements' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Yes', 'jet-elements' ),
'label_off' => esc_html__( 'No', 'jet-elements' ),
'return_value' => 'yes',
'default' => 'no',
)
);
$this->add_control(
'item_list',
array(
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => array(
array(
'item_label' => esc_html__( 'Section 1', 'jet-elements' ),
'item_section_id' => 'section_1',
),
array(
'item_label' => esc_html__( 'Section 2', 'jet-elements' ),
'item_section_id' => 'section_2',
),
array(
'item_label' => esc_html__( 'Section 3', 'jet-elements' ),
'item_section_id' => 'section_3',
),
),
'title_field' => '{{{ item_label }}}',
)
);
$this->end_controls_section();
$this->start_controls_section(
'section_settings',
array(
'label' => esc_html__( 'Settings', 'jet-elements' ),
)
);
$this->add_control(
'position',
array(
'label' => esc_html__( 'Position', 'jet-elements' ),
'type' => Controls_Manager::SELECT,
'default' => 'right',
'options' => array(
'left' => esc_html__( 'Left', 'jet-elements' ),
'right' => esc_html__( 'Right', 'jet-elements' ),
),
)
);
$this->add_control(
'speed',
array(
'label' => esc_html__( 'Scroll Speed', 'jet-elements' ),
'type' => Controls_Manager::NUMBER,
'default' => 500,
)
);
$this->add_control(
'offset',
array(
'label' => esc_html__( 'Scroll Offset', 'jet-elements' ),
'type' => Controls_Manager::NUMBER,
'default' => 0,
)
);
$this->add_control(
'full_section_switch',
array(
'label' => esc_html__( 'Section Switch', 'jet-elements' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Yes', 'jet-elements' ),
'label_off' => esc_html__( 'No', 'jet-elements' ),
'return_value' => 'yes',
'default' => 'no',
)
);
$this->add_control(
'full_section_switch_on_mobile',
array(
'label' => esc_html__( 'Use Section Switch On Mobile', 'jet-elements' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Yes', 'jet-elements' ),
'label_off' => esc_html__( 'No', 'jet-elements' ),
'return_value' => 'yes',
'default' => 'yes',
'condition' => [
'full_section_switch' => 'yes'
],
)
);
$this->add_control(
'hint_visible',
array(
'label' => esc_html__( 'Hint', 'jet-elements' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
)
);
$this->add_control(
'hint_show_type',
array(
'label' => esc_html__( 'Show Type', 'jet-elements' ),
'type' => Controls_Manager::SELECT,
'default' => 'show-active-hint',
'options' => array(
'show-active-hint' => esc_html__( 'Show Active Hint', 'jet-elements' ),
'show-hint-on-hover' => esc_html__( 'Show Hint On Hover', 'jet-elements' ),
),
)
);
$this->add_control(
'desktop_hint_hide',
array(
'label' => esc_html__( 'Hide On Desktop', 'jet-elements' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Hide', 'jet-elements' ),
'label_off' => esc_html__( 'Show', 'jet-elements' ),
'return_value' => 'yes',
'default' => 'no',
)
);
$this->add_control(
'tablet_hint_hide',
array(
'label' => esc_html__( 'Hide On Tablet', 'jet-elements' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Hide', 'jet-elements' ),
'label_off' => esc_html__( 'Show', 'jet-elements' ),
'return_value' => 'yes',
'default' => 'no',
)
);
$this->add_control(
'mobile_hint_hide',
array(
'label' => esc_html__( 'Hide On Mobile', 'jet-elements' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Hide', 'jet-elements' ),
'label_off' => esc_html__( 'Show', 'jet-elements' ),
'return_value' => 'yes',
'default' => 'no',
)
);
$this->end_controls_section();
/**
* General Style Section
*/
$this->_start_controls_section(
'section_general_style',
array(
'label' => esc_html__( 'General', 'jet-elements' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
)
);
$this->_add_group_control(
Group_Control_Background::get_type(),
array(
'name' => 'instance_background',
'selector' => '{{WRAPPER}} ' . $css_scheme['instance'],
),
50
);
$this->_add_group_control(
Group_Control_Border::get_type(),
array(
'name' => 'instance_border',
'label' => esc_html__( 'Border', 'jet-elements' ),
'placeholder' => '1px',
'default' => '1px',
'selector' => '{{WRAPPER}} ' . $css_scheme['instance'],
),
75
);
$this->_add_responsive_control(
'instance_border_radius',
array(
'label' => __( 'Border Radius', 'jet-elements' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array( 'px', '%' ),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['instance'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
),
75
);
$this->_add_responsive_control(
'instance_padding',
array(
'label' => __( 'Padding', 'jet-elements' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array( 'px', '%' ),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['instance'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
),
50
);
$this->_add_responsive_control(
'instance_margin',
array(
'label' => __( 'Margin', 'jet-elements' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array( 'px', '%' ),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['instance'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
),
25
);
$this->_add_group_control(
Group_Control_Box_Shadow::get_type(),
array(
'name' => 'instance_box_shadow',
'selector' => '{{WRAPPER}} ' . $css_scheme['instance'],
Loading ...