What is the advantage or disadvantage of doing a modal window in this way?

1

I have seen many plugins that allow to integrate modal windows in our webs, which contain a lot of javascript code.

On the w3school page they have a modal type made with little javascript code, using GetElementById , which is part of javascript.

My question is is it better to use the second option? for the matter of not overloading the site or is the first option better, why?

When I say overload I mean a lot of code. Are there any advantages, which?

    
asked by luis 25.11.2016 в 05:40
source

1 answer

3

The advantages of using a plugin are:

  • Already implemented code of the functionality you require (in this case, a modal window).
  • In many cases, configuration parameters and a multitude of options.

The disadvantages of using a plugin are:

  • It may not be exactly designed for your use case (it does not do exactly what you want and you have less control over it).
  • Ignorance of the code (may be inefficient, for example). It is important to check the popularity of the plugin so as not to "hang".

Therefore, there is no one better than another, but it depends on your needs. If, for example, you only need to show and close a window, it should not take long to write it in flat javascript, but if you need more features, it may be worth spending a few minutes looking for a plugin and not worrying about the "amount of javascript" , because possibly writing something similar would also require that amount of code.

    
answered by 25.11.2016 / 11:28
source