This topic contains 2 replies, has 2 voices, and was last updated by Zis Zis 3 years, 1 month ago.

Javascript structure


  • michaelrtm
    Participant

    Posts: 1
    Member Reply #1567

    First off, let me say I love Metronic! After purchasing it 2 years ago, I’m finally getting around it using it!

    I’ve run into an issue where I can get my jQuery stuff running on pc, but not tablets.

    The problem seems to step from how Metronic implements the js structure.

    I’m moving my code slowly over to the

    var page = function (){
    var someFunction = function(){};
    return{
    init: function(){};
    };
    }();

    style, but can’t find much documentation on it.

    I want a repeatable function – example: a function that resets my page depending on array passed to the function

    function ResetPage(options){
    if($.inArray("option1", options ) !== -1){
    // do stuff
    }
    if($.inArray("option2", options)!== -1){
    //do more stuff
    }
    };

    What is the best way to implement this (should it be in the return, or above the return?)? I need it called on form submits, and a few different button presses around the page


    michaelrtm
    Participant

    Posts: 1
    Member Reply #1568

    I seem to have found my answer.

    Place it above the return and just call it as usual.

    Thanks, you were a great help!! haha! 😀

    Zis
    Zis
    Participant

    Posts: 150
    Support Staff Reply #1573

    Dear Michaelrtm,

    Sorry for late reply. We are glad you have solved the issue.

    Meanwhile if you need more clarification let us know. Our theme support will be glad to help.

    Thanks in advance 😉

You must be logged in to reply to this topic.