Question

Hi Guys I downloaded a search box suggestion from the link

Search box suggestion

In it there is a .js file http://code.jquery.com/ui/1.10.3/jquery-ui.js in this link

The .js size of 426kb is the problem. . .Is there anyway that the code inside it can be reduced, or is their any easy coding for search box suggestion. . in jquery or else in javascript Please help me out guys.

Était-ce utile?

La solution

Yes, just use the minified version:

http://code.jquery.com/ui/1.10.3/jquery-ui.min.js

This is 223kb. Alternatively, you can "roll your own" by clicking http://jqueryui.com/download/ and choosing the required elements that you need.

Autres conseils

If you are using bower, you can alternatively only select the modules you need, and override the jquery's default on your bower.json file. The override section on your bower.json file would then be:

"overrides": {
  "jquery-ui": {
    "main": [
      "ui/core.js",
      "ui/widget.js",
      "ui/mouse.js",
      "ui/position.js",
      "ui/draggable.js",
      "ui/droppable.js",
      "themes/smoothness/jquery-ui.css"
    ]
  }
}

Note that core, widget, mouse and position are required by other modules, so they should be included first (and in that order).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top