• jlim
jLim – compact JavaScript framework

jLim is een mini JavaScript framework (package ~13kb minified) en bevat de meest gebruikte functies van jQuery. Ideaal voor minder complexe websites. jLim is vanaf nul opgebouwd, maar heeft een interface dat ongeveer gelijk is aan jQuery.

jLim bevat de volgende modules:

  • Core (~2.5kb)
  • DOM (~2.3kb)
  • CSS (~1.3kb)
  • Event (~2.3kb)
  • Ajax (~0.5kb)

En het bevat de (externe) componenten, die zijn opgenomen in de package:

Hoe werkt het?

$('a').attr('title', 'Open this link');

$('#btn').removeClass('active');

var size = $('li').size();

var el = $('li').get(1);

Voorbeeld met chainen

$('#wrapper')
	.find('p')
		.html('Lorem ipsum...')
		.eq(2)
			.css('background-color', '#ff0000')
		.end()
	.end()
	.find('button')
		.click(function(){
			$(this).addClass('highlight');
		})
	.end();

API documentatie

Download

Je kan de laatste versie downloaden van Github.

Browser Support

Getest in IE6+, FF, Opera, Chrome and Safari (voor Windows).

Licentie

Code valt onder de MIT licentie.

Gerelateerde artikelen

Fork me on GitHub

Reacties (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

Stuur je reactie

  • RSS
  • LinkedIn
  • Twitter