Start function in a specific tag with pure JavaScript (gridalicious)

1

Well, I would like to ask your help to resolve this question I am facing.

What would be the equivalent, in pure JavaScript, of the following jQuery code

    $(document).function();

Being more specific, I'm trying to rewrite this code below.

    $(".grid-a-licious").gridalicious({ //parameters })
    
asked by anonymous 19.03.2015 / 19:31

1 answer

1

I have to answer something else first:

When you have $(".grid-a-licious").gridalicious({ //parameters }) you can separate this into two parts:

$(".grid-a-licious") is basically a selector to go fetch DOM elements, ie this will return an array of jQuery objects with DOM elements that have the grid-a-licious class.

$ is a function that jQuery creates and is the basis of the jQuery API.

Then, to these elements, the .gridalicious() method will be run. This implies that you have to have jQuery loaded and still a separate file (plugin) with a certain functionality, in this case the gridalicious . This plugin has been added to the jQuery prototype which means that all objects returned by jQuery have this method. This can be done with:

$.prototype.gridalicious = function(){ };

That is, when you ask how to write in pure JavaScript. Apart from the jQuery that is a huge library, only this plugin has 327 lines of code and you can not answer here about how to convert to pure JavaScript as you should understand.

What I suggest is to try to better describe the functionality you are looking for, which you have already tested and put it in another question. Modern CSS is probably already doing most of the functionality you need.

    
19.03.2015 / 19:53