• jlim
jLim – compact JavaScript framework

jLim est un cadre mini JavaScript (package ~ 13kb minifiés) et contient les fonctions les plus utilisées de jQuery. Idéal pour les sites moins complexes. jLim est à partir de zéro, mais a une interface qui est approximativement égale à jQuery.

jLim contient les modules suivants:

  • Noyau (~ 2.5kb)
  • ARRÊT (~ 2.3kb)
  • CSS (~ 1.3kb)
  • Événement (~ 2.3kb)
  • Ajax (~ 0.5kb)

Et il contient le (externe) composants, inclus dans le forfait:

Comment ça marche??

$(«A»,).attr('Title', 'Ouvrir ce lien »);

$('# Btn').removeClass(«Active»);

var taille = $('Li').taille();

var el = $('Li').obtenir(1);

Exemple de chaînage

$('# Wrapper »)
	.trouver(«P»)
		.html("Lorem ipsum ...")
		.eq(2)
			.css('Background-color', "# FF0000")
		.que()
	.que()
	.trouver(«Bouton»)
		.cliquez(fonction(){
			$(cette).addClass('Highlight');
		})
	.que();

Documentation de l'API

Télécharger

Vous pouvez télécharger la dernière version de Github.

Support du navigateur

Testé dans IE6 , FF, Opera, Chrome et Safari (pour Windows).

Licence

Code de relève de la MIT License.

Related Articles

Fork me on GitHub

Commentaires (9)

  • do you plan an event modul ?

  • Here you go….jLim Event Plugin

  • This is an amazing mini js framework.

    Just starting to sink my teeth into it. No going back to jQuery now.

    Thanks for creating jLim ;)

    Alex

  • Again: this is just really really nicely done – only bit I miss slightly when working with complex code is jQuery’s deferred object – but this is tiny issue compared to the overall brilliance of having access to most of the basic features from jQuery is such a small library.. Thanks!

  • So when are you going to put this project up on github so we can all start forking and keeping up with updates?

    This is a great beginning for those simple sites that don’t need 30kB+ of extra Javascript code to parse on each page.

  • Good point David. I try to put it on Github this week.

    And Janus, that way anyone can add an extention, like a deferred object ;)

    @Alex: Thanks!

  • Is there any way to return a node/element index like jQuery’s index() function?

    Alex

  • @Alex You could use this code:

    (jLim.core || jLim.fn).extend({
        index: function (element) {
            var el = jLim(element).get(0);

            for (var x = 0, y = this.length; x < y; x++) {
                if (this.els[x] === el)
                    return x;
            }

            return null;
        }
    });

    Examples:

    $('button').index(document.getElementById('btn-test1'));
    $('button').index('#btn-test1');
    $('button').index($('#btn-test1'));

    It doesn't work exactly like jQuery's index, but this should do the job.

  • Awesome! cheers Victor.

    Keep up the good work on jLim

Envoyez votre commentaire

  • RSS
  • LinkedIn
  • Twitter