Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
effone committed Aug 21, 2018
1 parent 17a94d0 commit ea9b4cb
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 0 deletions.
1 change: 1 addition & 0 deletions dist/jquery.ruk.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/jquery.ruk.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions example/base.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
body {
background: #f4fbff;
font-family: 'Maitree', serif;
}

#container {
width: 80vw;
margin: 0 auto;
padding: 20px;
background: #FFF;
}
3 changes: 3 additions & 0 deletions example/base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$( "#ruk" ).ruk({
only: true
});
50 changes: 50 additions & 0 deletions example/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<title>jquery.ruk</title>
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css" />
<link type="text/css" rel="stylesheet" href="https://fonts.googleapis.com/css?family=Maitree:400,700">
<link type="text/css" rel="stylesheet" href="base.css" />
<link type="text/css" rel="stylesheet" href="../src/jquery.ruk.css" />
</head>

<body>
<div id="container">
<h2>jquery.ruk</h2>
<div id="ruk">
<div>
<div>First Title</div>
<div>
Omit optional fields and think of other ways to collect data. Always ask yourself if the question can be inferred, postponed, or completely excluded.

Data entry is increasingly automated. For example, mobile and wearable devices collect large amounts of data without the user’s conscious awareness. Think of ways you can leverage social, conversational UI, SMS, email, voice, OCR, location, fingerprint, biometric, etc.
</div>
</div>
<div>
<div>Second Title</div>
<div>
Omit optional fields and think of other ways to collect data. Always ask yourself if the question can be inferred, postponed, or completely excluded.

Data entry is increasingly automated. For example, mobile and wearable devices collect large amounts of data without the user’s conscious awareness. Think of ways you can leverage social, conversational UI, SMS, email, voice, OCR, location, fingerprint, biometric, etc.
</div>
</div>
<div>
<div>Third Title</div>
<div>
Omit optional fields and think of other ways to collect data. Always ask yourself if the question can be inferred, postponed, or completely excluded.

Data entry is increasingly automated. For example, mobile and wearable devices collect large amounts of data without the user’s conscious awareness. Think of ways you can leverage social, conversational UI, SMS, email, voice, OCR, location, fingerprint, biometric, etc.
</div>
</div>
</div>
<!-- copyright notice.-->
<p>&#169; effone, 2018</p>
</div>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../src/jquery.ruk.js"></script>
<script type="text/javascript" src="base.js"></script>
</body>

</html>
27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "jquery.ruk",
"version": "1.0.0",
"description": "Yet another full-fledged jQuery accordion plugin with bare minimum code",
"main": "./dist/jquery.ruk.min.js",
"ecosystem": "jquery",
"scripts": {
"test": "jest"
},
"repository": {
"type": "git",
"url": "git+https://github.com/effone/jquery.ruk.git"
},
"keywords": [
"jquery-plugin",
"accordion",
"bare",
"small",
"tiny"
],
"author": "effone",
"license": "MIT",
"bugs": {
"url": "https://github.com/effone/jquery.ruk/issues"
},
"homepage": "https://github.com/effone/jquery.ruk#readme"
}
16 changes: 16 additions & 0 deletions src/jquery.ruk.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.ruk>div>* {
border: 1px solid #EEE;
padding: 10px;
}

.ruk>div>.rq {
background: #FBFBFB;
font-weight: 700;
margin-top: 5px;
cursor: pointer;
}

.ruk>div>.ra {
border-top: none;
display: none;
}
15 changes: 15 additions & 0 deletions src/jquery.ruk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(function ($) {
$.fn.ruk = function (options) {
var settings = $.extend({
only: true
}, options);
$(this).addClass("ruk").children('div div').children('div:first-child').addClass("rq").next('div').addClass('ra');

$('.rq').on('click', function () {
if (settings.only) {
$('.rq').not(this).next('.ra').slideUp('fast');
}
$(this).next('.ra').slideToggle('fast');
})
};
}(jQuery));

0 comments on commit ea9b4cb

Please sign in to comment.