Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Stanescu committed Jun 9, 2014
0 parents commit 1f395d0
Show file tree
Hide file tree
Showing 14 changed files with 4,856 additions and 0 deletions.
171 changes: 171 additions & 0 deletions animate.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
<html>
<head>
<!-- Locks Web-Kit down on iPhone and Android, setting the
initial view to occupy the entire screen and not allowing
the user to scale the viewport. -->
<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>

<!-- jQuery lite (JQLite) -->
<script src="jqlite.1.1.1.min.js" type="text/javascript"></script>

<!-- jQAnimation extension -->
<script src="extensions/jq.animation.min.js" type="text/javascript"></script>


<style type="text/css">
body {
font: 10pt Arial,Helvetica,Sans-serif;
margin-left: 5px;
margin-right: 5px;
}

div.showUp {
background: #00f;
color: white;
font-weight: bold;
display:none;
width: 120px;
height: 120px;
border: 2px solid #aaf;
margin-top: 10px;
}

div.button {
border: 1px solid;
background: silver;
padding: 8px;
display: inline-block;
cursor: pointer;
margin-right: 15px;
}

div.grower,
div.mover {
background: #f00;
color: white;
font-weight: bold;
width: 120px;
height: 120px;
border: 2px solid #faa;
margin-top: 10px;
position: relative;
}

div.expander {
background: #ff0;
color: black;
font-size: 14px;
margin-top: 10px;
border: 1px solid;
display: inline-block;
}

</style>

<script type="text/javascript">
$(document).ready(function() {
$("div.button1").click(function() {
$("div.showUp").show(3000);
});
$("div.button2").click(function() {
$("div.showUp").hide(1000);
});

$("div.button3").click(function() {
$("div.mover").animate({
left: "+=80"
});
});
$("div.button4").click(function() {
$("div.mover").animate({
left: "-=80"
});
});

$("div.button5").click(function() {
$("div.expander").animate({
fontSize: "24px"
});
});
$("div.button6").click(function() {
$("div.expander").animate({
fontSize: "14px"
});
});

$("div.button7").click(function() {
$("div.grower").animate({
width: "240px"
}).animate({
height: "240px"
});
});
$("div.button8").click(function() {
$("div.grower").animate({
width: "120px"
}).animate({
height: "120px"
});
});
});
</script>

</head>
<body>

<h1>jQAnimation - jQuery FX library extension</h1>
<p>
The following is a test of extending jQLite with the jQuery
animation libraries.
</p>

<div class="button button1">
Show Box
</div>
<div class="button button2">
Hide Box
</div>
<div class="showUp">
Are we visible yet?
</div>

<hr/>

<div class="button button3">
Move Right
</div>
<div class="button button4">
Move Left
</div>
<div class="mover">
Am I moving Yet?
</div>

<hr/>

<div class="button button5">
Expand
</div>
<div class="button button6">
Shrink
</div> <br/>
<div class="expander">
Getting Bigger?
</div>

<hr/>

<div class="button button7">
Bigger
</div>
<div class="button button8">
Smaller
</div> <br/>
<div class="grower">
Width &amp; Height
</div>

<hr/>
<a href="index.html">&lt;&lt;&nbsp;Back to demo page</a>
</body>
</html>
26 changes: 26 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "jqlite",
"version": "1.1.1",
"authors": [
"[email protected]"
],
"description": "A jQuery replacement for Blackberry and other limited mobile devices",
"main": "jqlite.1.1.1.js",
"moduleType": [
"globals"
],
"keywords": [
"jquery",
"lite",
"jqlite"
],
"license": "MIT",
"homepage": "https://code.google.com/p/jqlite/",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}
122 changes: 122 additions & 0 deletions extensions/jq.accordian.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/*
* jqAccordian - Accordian extension for jQuery/jQLite.
*
* Copyright (c) 2010 Brett Fattori ([email protected])
* Licensed under the MIT license
* http://www.opensource.org/licenses/mit-license.php
*
* A simple extension which will convert an UL into an accordian object.
* The LI elements must contain two elements themselves:
*
* - An element with class "title"
* - An element with class "body"
*
* The element with class "title" will always show. If it is clicked upon,
* it will open the corresponding body. The plugin takes some options:
*
* openOne - {boolean} If true (default), only one body can be open at a time.
* Clicking the title will open the body, and close any other open
* bodies. If false, clicking the title will toggle the body open
* and closed.
*
* animated - {boolean} If true, the accordian will open and close using
* the slideUp() and slideDown() animations. "jqanimation.js"
* extension is required for use!
*
*/


(function(jQuery) {
jQuery.fn.extend({
jqAccordian: function(opts) {

var o = jQuery.extend({
openOne: true,
animated: false
}, opts);

return this.each(function() {
var jQ = $(this);
if (jQ.hasClass("jq-accordian")) {
// If it's already an accordian, just exit
return;
}

// Set a class identifying the UL as an accordian
jQ.addClass("jq-accordian");

// Collapse the elements with the "body" class. If openOne is
// false, collapse all of them. If true, collapse all but the
// first one.
$(".body", jQ).each(function(i) {
var b = $(this);
if ((o.openOne && i > 0) || !o.openOne) {
b.hide();
}
});

// Wire up the elements with the "title" class
// to open/close the tab's body
$(".title", jQ).each(function() {
var t = $(this); // title
if (t.parent().parent()[0] == jQ[0]) {
t.click(function() {
var tjQ = $(this); // title
if (o.openOne) {
// Find all of the bodies and close them
$(".body", jQ).each(function() {
var b = $(this); // body
if (b.parent().parent()[0] == jQ[0]) {
if (o.animated) {
b.slideUp(250);
} else {
b.hide();
}
}
});
// Show our own body
$(".body", tjQ.parent()).each(function() {
var b = $(this); // body
if (b.parent().parent()[0] == tjQ.parent()[0]) {
if (o.animated) {
b.slideDown(450);
} else {
b.show();
}
}
});
} else {
var tp = tjQ.parent(); // li
if (tp.hasClass("jq-accordian-open")) {
tp.removeClass("jq-accordian-open");
$(".body", tp).each(function() {
var b = $(this); // body
if (b.parent().parent()[0] == tp.parent()[0]) {
if (o.animated) {
b.slideUp(450);
} else {
b.hide();
}
}
});
} else {
tp.addClass("jq-accordian-open");
$(".body", tp).each(function() {
var b = $(this); // body
if (b.parent().parent()[0] == tp.parent()[0]) {
if (o.animated) {
b.slideDown(450);
} else {
b.show();
}
}
});
}
}
});
}
});
});
}
});
})(jQuery);
29 changes: 29 additions & 0 deletions extensions/jq.accordian.min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* jqAccordian - Accordian extension for jQuery/jQLite.
*
* Copyright (c) 2010 Brett Fattori ([email protected])
* Licensed under the MIT license
* http://www.opensource.org/licenses/mit-license.php
*
* A simple extension which will convert an UL into an accordian object.
* The LI elements must contain two elements themselves:
*
* - An element with class "title"
* - An element with class "body"
*
* The element with class "title" will always show. If it is clicked upon,
* it will open the corresponding body. The plugin takes some options:
*
* openOne - {boolean} If true (default), only one body can be open at a time.
* Clicking the title will open the body, and close any other open
* bodies. If false, clicking the title will toggle the body open
* and closed.
*
* animated - {boolean} If true, the accordian will open and close using
* the slideUp() and slideDown() animations. "jqanimation.js"
* extension is required for use!
*
*/
(function(g){g.fn.extend({jqAccordian:function(h){var b=g.extend({openOne:true,animated:false},h);return this.each(function(){var c=$(this);if(!c.hasClass("jq-accordian")){c.addClass("jq-accordian");$(".body",c).each(function(f){var e=$(this);if(b.openOne&&f>0||!b.openOne)e.hide()});$(".title",c).each(function(){var f=$(this);f.parent().parent()[0]==c[0]&&f.click(function(){var e=$(this);if(b.openOne){$(".body",c).each(function(){var a=$(this);if(a.parent().parent()[0]==c[0])b.animated?a.slideUp(250):
a.hide()});$(".body",e.parent()).each(function(){var a=$(this);if(a.parent().parent()[0]==e.parent()[0])b.animated?a.slideDown(450):a.show()})}else{var d=e.parent();if(d.hasClass("jq-accordian-open")){d.removeClass("jq-accordian-open");$(".body",d).each(function(){var a=$(this);if(a.parent().parent()[0]==d.parent()[0])b.animated?a.slideUp(450):a.hide()})}else{d.addClass("jq-accordian-open");$(".body",d).each(function(){var a=$(this);if(a.parent().parent()[0]==d.parent()[0])b.animated?a.slideDown(450):
a.show()})}}})})}})}})})(jQuery);
Loading

0 comments on commit 1f395d0

Please sign in to comment.