Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
barionleg authored Jan 4, 2025
1 parent 87b09e3 commit 2995dab
Show file tree
Hide file tree
Showing 5 changed files with 296 additions and 2 deletions.
54 changes: 52 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,52 @@
# NuclideChart
You can view the chart online at https://gustavlindberg99.github.io/NuclideChart/. You can download the chart in the SVG format by clicking on "Download Chart (SVG)", or download the data in the CSV format by clicking on "Download Data (CSV)". The data is from https://www.nndc.bnl.gov/.

# Content Zoom Slider

https://aibolem.github.io/content-zoom-slider/example/content-zoom-slider-example.html

Jquery plugin to zoom in/out area in browser with slider.

![](/example/content-zoom-slider-demo.gif?raw=true "Title")

## Requirements
Jquery

bootstrap css (for best view)

## Usage

You can refer my youtube video, in which i have explained full implementation. [click here](https://www.youtube.com/embed/C6DM_xQ7BsY)


1. Download and include "content-zoom-slider.min.js" file from src folder.
```html
<script src="../src/content-zoom-slider.min.js"></script>
```
2. Initialize plugin
```html
<div id="content">
Content area
</div>
<div class="zoom-tool-bar">

</div>

<script>
$(function () {
$("#content").contentZoomSlider({
toolContainer: ".zoom-tool-bar"
});
});
</script>
```
## Options
``` html
<script>
$("#content").contentZoomSlider({
toolContainer: ".zoom-tool-bar", // element where slider bar will show
setp: 25, // step size
min: 25, // min range
max: 200, // max range
zoom: 100, // default zoom size
});
</script>
```
Binary file added example/content-zoom-slider-demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
144 changes: 144 additions & 0 deletions example/content-zoom-slider-example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<!DOCTYPE html>
<html>
<head>
<title>Content zoom slider example</title>
<!-- CSS only -->
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
crossorigin="anonymous"
/>
<link
rel="stylesheet"
href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css"
integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p"
crossorigin="anonymous"
/>
<style>
.zoom-tool-bar {
position: fixed;
bottom: 0;
right: 0;
width: 100%;
height: 31px;
padding: 3px 0;
background: rgba(49, 65, 82, 0.7);
font-size: 13px;
z-index: 9999;
color: #fff;
}

.zoom-tool-bar i {
color: #77b3ff;
font-size: 16px;
}
</style>
</head>
<body>
<div id="content">
<div class="row m-5">
<div class="col-sm-6">
<h2>What is Lorem Ipsum?</h2>
<p>
<strong>Lorem Ipsum</strong> is simply dummy text of the printing
and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text ever since the 1500s, when an unknown printer
took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into
electronic typesetting, remaining essentially unchanged. It was
popularised in the 1960s with the release of Letraset sheets
containing Lorem Ipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem
Ipsum.
</p>
</div>
<div class="col-sm-6">
<h2>Where does it come from?</h2>
<p>
Contrary to popular belief, Lorem Ipsum is not simply random text.
It has roots in a piece of classical Latin literature from 45 BC,
making it over 2000 years old. Richard McClintock, a Latin professor
at Hampden-Sydney College in Virginia, looked up one of the more
obscure Latin words, consectetur, from a Lorem Ipsum passage, and
going through the cites of the word in classical literature,
discovered the undoubtable source. Lorem Ipsum comes from sections
1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes
of Good and Evil) by Cicero, written in 45 BC. This book is a
treatise on the theory of ethics, very popular during the
Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit
amet..", comes from a line in section 1.10.32. The standard chunk of
Lorem Ipsum used since the 1500s is reproduced below for those
interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et
Malorum" by Cicero are also reproduced in their exact original form,
accompanied by English versions from the 1914 translation by H.
Rackham.
</p>
</div>
</div>
<div class="row m-5">
<div class="col-sm-6">
<h2>Why do we use it?</h2>
<p>
It is a long established fact that a reader will be distracted by
the readable content of a page when looking at its layout. The point
of using Lorem Ipsum is that it has a more-or-less normal
distribution of letters, as opposed to using 'Content here, content
here', making it look like readable English. Many desktop publishing
packages and web page editors now use Lorem Ipsum as their default
model text, and a search for 'lorem ipsum' will uncover many web
sites still in their infancy. Various versions have evolved over the
years, sometimes by accident, sometimes on purpose (injected humour
and the like).
</p>
</div>
<div class="col-sm-6">
<h2>Where does it come from?</h2>
<p>
Contrary to popular belief, Lorem Ipsum is not simply random text.
It has roots in a piece of classical Latin literature from 45 BC,
making it over 2000 years old. Richard McClintock, a Latin professor
at Hampden-Sydney College in Virginia, looked up one of the more
obscure Latin words, consectetur, from a Lorem Ipsum passage, and
going through the cites of the word in classical literature,
discovered the undoubtable source. Lorem Ipsum comes from sections
1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes
of Good and Evil) by Cicero, written in 45 BC. This book is a
treatise on the theory of ethics, very popular during the
Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit
amet..", comes from a line in section 1.10.32.
</p>
<p>
The standard chunk of Lorem Ipsum used since the 1500s is reproduced
below for those interested. Sections 1.10.32 and 1.10.33 from "de
Finibus Bonorum et Malorum" by Cicero are also reproduced in their
exact original form, accompanied by English versions from the 1914
translation by H. Rackham.
</p>
</div>
</div>
</div>

<div class="zoom-tool-bar"></div>
<script
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous"
></script>
<script src="../src/content-zoom-slider.min.js"></script>
<script>
$(function () {
$("#content").contentZoomSlider({
toolContainer: ".zoom-tool-bar",
});

// $("#content").contentZoomSlider({
// toolContainer: ".zoom-tool-bar",
// step: 50,
// zoom: 150,
// max:500
// }); -->
});
</script>
</body>
</html>
99 changes: 99 additions & 0 deletions src/content-zoom-slider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
(function ($) {
$.fn.contentZoomSlider = function (options) {
let $this = $(this),
r=".ranger";
// Default options
let settings = $.extend(
{
toolContainer: "#tool-container",
setp: 25,
min: 25,
max: 200,
zoom: 100,
},
options
);

init();

function init() {
addToolBar();
registerEvents();
setZoomValue(settings.zoom/100);
}

function registerEvents() {
$(document)
.off("click", `${settings.toolContainer} .zoom-out`)
.on("click", `${settings.toolContainer} .zoom-out`, function () {
zoomOut();
});

$(document)
.off("click", `${settings.toolContainer} .zoom-in`)
.on("click", `${settings.toolContainer} .zoom-in`, function () {
zoomIn();
});

$(document)
.off("mousemove", `${settings.toolContainer} ${r}`)
.on(
"mousemove",
`${settings.toolContainer} ${r}`,
function () {
zoomScroll();
}
);
}

function addToolBar() {
$(settings.toolContainer).html(`<div class="row">
<div class="col-sm-12 p-1 text-center zoominout">
<span class="zoom-value">${settings.zoom}%</span>
<a href="#" title="Zoom Out" class="zoom-out"> <i class="fa fa-minus m-1"></i> </a>
<input class="mb-1 ranger" type="range" value="${settings.zoom / 100}" step="${
settings.setp / 100
}" min="${settings.min / 100}" max="${settings.max / 100}" />
<a href="#" title="Zoom In" class="zoom-in"> <i class="fa fa-plus m-1"></i></a>
</div>
</div>`);
}

function zoomIn() {
let zoom = getZoomValue();
if (zoom < settings.max/100) {
setZoomValue(zoom + settings.setp/100);
}
}

function zoomOut() {
let zoom = getZoomValue();
if (zoom > settings.min/100) {
setZoomValue(zoom - settings.setp/100);
}
}

function zoomScroll() {
let zoom = parseFloat($(`${settings.toolContainer} ${r}`).val());
setZoomValue(zoom);
}

function getZoomValue() {
let zoom = parseFloat($this.css("zoom"));
if (!zoom) {
zoom = 1;
}
return zoom;
}

function setZoomValue(zoom) {
$this.css('-moz-transform', `scale(${zoom}`);
$this.css('transform-origin', '50%,0');

$this.css({ zoom: zoom });

$(`${settings.toolContainer} ${r}`).val(zoom);
$(`${settings.toolContainer} .zoom-value`).text((zoom * 100).toFixed(0) + "%");
}
};
})(jQuery);
1 change: 1 addition & 0 deletions src/content-zoom-slider.min.js

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

0 comments on commit 2995dab

Please sign in to comment.