1

I have installed a component called 'Responsive Scroll Triggered Box', but when I activate the component, it gives Javascript errors, and makes the sideshow crash because of it.
This is the component script.js file

/**
 * @package         Responsive Scroll Triggered Box
 * @author          Tassos Marinos <[email protected]>
 * @link            http://www.tassos.gr
 * @copyright       Copyright © 2015 TM Extensions All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

var jqRSTBox = jQuery.noConflict();

(function($) {
    $(document).ready(function() {

        /* Joomla <= 3.3.6 - Added change trigger when check the radio input */
        $('.btn-group label:not(.active)').click(function() {
            var input = $('#' + $(this).attr('for'));
            if (!input.prop('checked')) {
                input.trigger('change');
            }
        });

        /* Trigger Method */
        $("#jform_triggermethod").change(function() {
            val = $(this).val();
            switch (val) {
                case "pageheight":
                    disableObjects = ["prmtriggerelement"];
                    break;
                case "pageload":
                    disableObjects = ["prmtriggerelement", "prmtriggerpercentage","prmautohide"];
                    break;
                case "userleave":
                    disableObjects = ["prmtriggerelement", "prmtriggerpercentage","prmtriggerdelay","prmautohide"];
                    break;
                case "element":
                    disableObjects = ["prmtriggerpercentage"];
                    break;
            }

            form = $(this).closest("form#adminForm");

            form.find(".control-group").removeClass("hide");
            disableObjects.each(function(x) {
                form.find(".control-group."+x).addClass("hide");
            })
        }).trigger('change');

        /* Show/Hide Fieldsets */
        showOnFields = [
            {
                "trigger": $('select#jform_boxtype'),
                "triggerValues": ["module"],
                "showField" : $("#module")
            },
            {
                "trigger": $('select#jform_boxtype'),
                "triggerValues": ["custom"],
                "showField" : $("#custom")
            },
            {
                "trigger": $('select#jform_boxtype'),
                "triggerValues": ["emailform"],
                "showField" : $("#emailform")
            },
            {
                "trigger": $('input[name="jform[prm_assign_devices]"]'),
                "triggerValues": ["1","2"],
                "showField" : $(".prmassigndeviceslist")
            },
            {
                "trigger": $('input[name="jform[prm_overlay]"]'),
                "triggerValues" : ["1"],
                "showField": $(".prmoverlaycolor, .prmoverlaypercent, .prmoverlayclick")
            },
            {
                "trigger": $('input[name="jform[prm_allmenus]"]'),
                "triggerValues" : ["0"],
                "showField": $(".menuitems")
            },
            {
                "trigger": $('input[name="jform[prm_assign_lang]"]'),
                "triggerValues": ["1","2"],
                "showField": $(".prmassignlanglist")
            },
            {
                "trigger": $('select[name="jform[prm_cookietype]"]'),
                "triggerValues": ["seconds","minutes", "days", "hours"],
                "showField": $(".cookie")
            }
        ]

        $.each(showOnFields, function(key, value) {
            trigger = $(value.trigger);
            trigger.on("change", function() {

                valid = false;

                if (value.triggerValues == ":checked") {
                    if ($(this).is(":checked")) {
                        valid = true;
                    }
                }

                if ($.isArray(value.triggerValues)) {
                    if ($.inArray($(this).val(), value.triggerValues) > -1) {
                        valid = true;
                    }   
                }  

                if (valid) {
                    value.showField.slideDown("fast");
                } else {
                    value.showField.slideUp("fast");
                }
            });

            if (trigger.is("select")) {
                trigger.trigger("change");
            }

            if (trigger.is("input:radio")) {
                trigger.filter(":checked").trigger("change"); 
            }
        });
    });
}(jqRSTBox));
3
  • Could you please tell us what these JS errors are?
    – Lodder
    Commented Jun 18, 2015 at 8:06
  • JS errors mean that there is a conflict between $ and jQuery. but the problem is solved. i just need to add a joomla plugin jquery-easy which removes the conflicts between the mootools and jquery Commented Jun 18, 2015 at 8:50
  • 1
    Please write this as an answer below and mark is as accepted to people know it has been solved ;)
    – Lodder
    Commented Jun 18, 2015 at 8:50

2 Answers 2

2

The problem is solved. I just need to add a joomla plugin jquery-easy which removes the conflicts between the mootools and jquery

0

I see this has been answered as a Mootools / JQuery conflict. It is worth noting that Mootools has been deprecated in Joomla 3, though I believe is still sometimes used in the admin.

The fact your site has Mootools and JQuery suggests that your template (or possibly some other extension) may be getting out-of-date, or your site unpatched if you are using a core template.

Up-to-date Joomla sites should be using JQuery only - it is probably worth looking into where and why Mootools is still being used.

For more details: https://docs.joomla.org/J3.x:Javascript_Frameworks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.