Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codecat/a.js
:earth_americas: My Javascript library
https://github.com/codecat/a.js
animations javascript
Last synced: 6 days ago
JSON representation
:earth_americas: My Javascript library
- Host: GitHub
- URL: https://github.com/codecat/a.js
- Owner: codecat
- License: mit
- Created: 2011-10-28T09:40:38.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2015-06-08T07:30:50.000Z (over 9 years ago)
- Last Synced: 2023-03-12T05:02:23.723Z (almost 2 years ago)
- Topics: animations, javascript
- Language: JavaScript
- Homepage:
- Size: 118 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: License
Awesome Lists containing this project
README
# a.js
## Minimalistic Javascript libraryThis Javascript library is very minimalistic, meant to just manage pages or do some more intensive things with just 1-3 lines.
Example usage:
```js
$.ready(function() { // This is executed when the document is ready.
// Get an element
var elm = $("#id");
// Set the contents of the entire body tag
$("body")[0].set("It works!
");
// Set the color of an h1 tag
$("h1")[0].style.color = "#f00";
// Append content to the body tag
$("body")[0].append("Hello world!
I'm just adding some p tags.
");
// Tell the user how many p tags there are
alert("There are " + $("p").length + " p tags.");
// Set the contents of the first p tag found in the document
$("p")[0].set("Changed from script!");
// Do an AJAX GET request
$.get("test.txt", function(result) {
alert("This is test.txt:\n\n" + result);
});
// Do an AJAX POST request
$.post("post.php", "test=" + escape("This is a test!"), function(result) {
alert("Response from server:\n\n" + result);
});
});
```If you include the animation libraries, you can do something like this to animate the width of a div (from 50px to 500px) smoothly:
```js
$("#someDiv").anim({
style: "width",
seconds: 1.0,
interpolate: "inOutQuad", // from a.easing.js
}).px(50, 500);
```