-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7938f37
commit cce9f98
Showing
6 changed files
with
109 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2013-2016 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "spacersjs", | ||
"version": "1.0.0", | ||
"description": "when you need more space", | ||
"main": "spacers/spacers.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/actuallyakash/spacers.git" | ||
}, | ||
"keywords": [ | ||
"spacers", | ||
"margin", | ||
"padding", | ||
"dragging" | ||
], | ||
"author": "actuallyakash", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/actuallyakash/spacers/issues" | ||
}, | ||
"homepage": "https://github.com/actuallyakash/spacers#readme" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,61 @@ | ||
## TODO: options needed | ||
|
||
|
||
## Done | ||
|
||
* element (selector on which the spacer is implemented) | type: string | ||
* appendHtml (to append spacer divs ) | type: string | values: (begin, end) | ref: https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML#visualization_of_position_names | default: afterbegin | ||
* padding (to enable padding, which'll be default behaviour) | type: boolean | ||
* margin (to enable margin) | type: boolean | ||
* onDragEnd (a function for using the values when drag is ended) | type: function | ref: interactjs | ||
* containedArea (use if you're not able to find the element (ex- iframe)) | type: object | ||
* spacerClass (for adding classes in the spacers) | type: string | ||
* defaultSpacing (default margin/padding values) | type: string | ||
* defaultPadding (an object with top, bottom, left, right values) | type: object | ||
* defaultMargin (an object with top, bottom, left, right values) | type: object | ||
* spacingUnit (to change default spacing unit of spacers like em, rem, in, cm ..etc) | type: string | ||
* showOnHover (to show spacers only on hover) | type: boolean | ||
* showSpacingValue (to show the margin/padding number in the center of spacer) | type: boolean | ||
* showLabel: (to show the label beside spacing value) | type: string | ||
* enableLock: (to link opposite spacers) | type: boolean | ||
* lockIcon | ||
default - <span class="lock"></span> | ||
* unlockIcon | ||
default - <span class="unlock"></span> | ||
spacers | ||
------- | ||
|
||
[1]: <https://github.com/actuallyakash/spacers> | ||
|
||
_when you need more space_ | ||
|
||
#### Demo | ||
|
||
[http://actuallyakash.github.io/spacers](http://actuallyakash.github.io/spacers/) | ||
|
||
#### Package Managers | ||
|
||
```sh | ||
# Bower | ||
bower install --save spacersjs | ||
|
||
# NPM | ||
npm install spacersjs | ||
``` | ||
|
||
### Settings | ||
|
||
**Option**|**Type**|**Default**|**Description** | ||
-----|-----|-----|----- | ||
element|string|null|Selector on which the spacer have to be initialized | ||
appendHtml|string|begin|To append spacer divs after or before the tag. Use `begin` to append in the beginning and `end` to append after the selector. | ||
padding|boolean|true|To enable padding, which is default behaviour | ||
margin|boolean|false|To enable margin | ||
onDragEnd|boolean|null|Function for using the spacer values when drag is ended | ||
containedArea|object (DOM node | jQuery object)|window.document|Use if you're not able to find the element (ex- when using iframe) | ||
spacerClass|object|null|For adding custom classes in the spacers | ||
defaultSpacing|string|null|Default margin/padding values | ||
defaultPadding|object|null|an object with top, bottom, left, right values | ||
defaultMargin|object|null|an object with top, bottom, left, right values | ||
spacingUnit|object|px|Change default spacing unit of spacers like em, rem, in, cm ..etc | ||
showOnHover|string|false|Show spacers only on hover | ||
showSpacingValue|boolean|false|Show the margin/padding values at the center of spacer | ||
showLabel|string|null|Show the label beside spacing value | ||
enableLock|boolean|false|Link opposite spacers | ||
lockIcon|string|<span class="lock"></span>|HTML string for lock icon | ||
unlockIcon|string|<span class="unlock"></span>|HTML string for unlock icon | ||
|
||
#### Example | ||
|
||
Initialize with: | ||
|
||
```javascript | ||
spacers({ | ||
element: '.inner-element' | ||
}); | ||
``` | ||
|
||
#### Dependencies | ||
|
||
Voila! It works without any dependencies. | ||
|
||
#### License | ||
|
||
Copyright (c) 2021 Akash Gupta | ||
Licensed under the MIT license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
--padding-bg: plum; | ||
--margin-bg: #463626; | ||
} | ||
|
||
/* Spacers Styling */ | ||
.spacer { | ||
position: absolute; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters