Viewer and markers selection from jQuery UI
How do I make an viewer and markers selection from jquery ui?
What is a viewer and markers selection from jquery ui? How do you make a viewer and markers selection from jquery ui? This script and codes were developed by Adrien Clerbois on 30 December 2022, Friday.
Viewer and markers selection from jQuery UI - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Viewer and markers selection from jQuery UI</title> <link rel='stylesheet prefetch' href='http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="action"> <a class="zoom-in">In</a> <a class="fit">Fit</a> <a class="zoom-out">Out</a> <div class="zoom-size">lll</div>
</div>
<div class="content"> <div class="wrapper"> <div class="spread"> <div class="left page"> <img class="thumb" src="http://footsalle-hainaut.be/img/test/page_1_thumb.jpg" /> <img class="full" src="http://footsalle-hainaut.be/img/test/page_1_large.jpg" /> </div> <div class="right page"> <img class="thumb" src="http://footsalle-hainaut.be/img/test/page_1_thumb.jpg" /> <img class="full" src="http://footsalle-hainaut.be/img/test/page_1_large.jpg" /> </div> <div class="markers"> <div class="marker marker-1"> </div> </div> </div> </div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Viewer and markers selection from jQuery UI - Script Codes CSS Codes
* { font-family: 'calibri';
}
.content { position: absolute; top: 0; left: 320px; right: 0; bottom: 0; padding: 0;
}
.content > .wrapper { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; -o-user-select: none; user-select: none; position: absolute; top: 39px; border: 1px solid red; left: 0; right: 0; bottom: 0; overflow: auto;
}
.content > .wrapper div { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; -o-user-select: none; user-select: none;
}
.content > .wrapper > .spread { position: absolute; cursor: hair;
}
.content > .wrapper > .spread > .page { position: absolute; width: 50%; height: 100%;
}
.content > .wrapper > .spread > .page.loaded > img { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; -o-user-select: none; user-select: none;
}
.content > .wrapper > .spread > .page.loaded > img.full { display: block;
}
.content > .wrapper > .spread > .page.loaded > img.thumb { display: none;
}
.content > .wrapper > .spread > .page.right { right: 1px;
}
.content > .wrapper > .spread > .page > img { position: absolute; width: 100%; height: 100%; border: none; outline: none;
}
.content > .wrapper > .spread > .page > img.full { display: none;
}
.content > .wrapper > .spread > .page > img.thumb { display: block;
}
.content > .wrapper > .spread > .markers { height: auto !important; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
}
.content > .wrapper > .spread > .markers > .marker { -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; -webkit-transform: translateZ(0px); -moz-transform: translateZ(0px); -o-transform: translateZ(0px); -ms-transform: translateZ(0px); transform: translateZ(0px); position: absolute; background-repeat: no-repeat; background-position: 50% 50%; background-color: rgba(0, 255, 0, 0.2); border: 1px solid #248820; z-index: 1; cursor: default;
}
.content > .wrapper > .spread > .markers > .marker.marker-1 { border: 2px solid red; width: 10%; height: 10%; top: 1%; left: 10%;
}
.content > .wrapper > .spread.single-page > .page.left { display: none;
}
.content > .wrapper > .spread.single-page > .page.right { width: 100%;
}
.content > .wrapper > .spread > .dummy { display: none;
}
.action { top: 0; left: 0 ; width: 320px; position: absolute; bottom: 0; padding: 0;
}
.action > a { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; -o-user-select: none; user-select: none; display: block; text-align: center; margin: 30px auto; border: 2px solid black; width: 100px; cursor: pointer;
}
.action > a:hover { background-color: black; color: white;
}
.action .zoom-size { display: block; border: 2px solid black; margin: 30px auto; width: 100px; text-align: center;
}
.action .zoom-size:after { content: '%'; padding: 0 10px;
}
Viewer and markers selection from jQuery UI - Script Codes JS Codes
window.acl = {};
window.acl.leftPageWidthRealSize = 0;
window.acl.leftPageHeightRealSize = 0;
window.acl.rightPageWidthRealSize = 0;
window.acl.rightPageHeightRealSize = 0;
window.acl.currentRatio = 1;
window.acl.stepRatio = 0.1;
window.acl.maxRatio = 1;
var realSize = function(jQuerySelector){ // From https://css-tricks.com/snippets/jquery/get-an-images-native-width/ // Get on screen image var screenImage = jQuerySelector; // Create new offscreen image to test var theImage = new Image(); theImage.src = screenImage.attr("src"); // Get accurate measurements from that. return {width : theImage.width, height: theImage.height};
}
var fitRatio = function(){ var result = 0; var $wrapper = $('.wrapper'); var $spread = $wrapper.find('.spread'); var wrapperHeight = $wrapper.height(); var wrapperWidth = $wrapper.width(); var width = 0; var height = 0; var left = 0; var top = 0; if($spread.hasClass('single-page')){ var isLeftImage = !$('.left').hasClass('no-page'); var $selector; if(isLeftImage){ width = window.acl.leftPageWidthRealSize; height = window.acl.leftPageHeightRealSize; } else { width = window.acl.rightPageWidthRealSize; height = window.acl.rightPageHeightRealSize; } } else { width = (window.acl.leftPageWidthRealSize) + (window.acl.rightPageWidthRealSize); height = (window.acl.leftPageHeightRealSize > window.acl.rightPageHeightRealSize) ? window.acl.leftPageHeightRealSize : window.acl.rightPageHeightRealSize; } var ratioHeigh = wrapperHeight / height; var ratioWidth = wrapperWidth / width; return ratioHeigh > ratioWidth ? ratioWidth : ratioHeigh;
}
var zoom = function(ratio) { var $wrapper = $('.wrapper'); var $spread = $wrapper.find('.spread'); var wrapperHeight = $wrapper.height(); var wrapperWidth = $wrapper.width(); var width = 0; var height = 0; var left = 0; var top = 0; if($spread.hasClass('single-page')){ var isLeftImage = !$('.left').hasClass('no-page'); var $selector; if(isLeftImage){ width = window.acl.leftPageWidthRealSize * ratio; height = window.acl.leftPageHeightRealSize * ratio; } else { width = window.acl.rightPageWidthRealSize * ratio; height = window.acl.rightPageHeightRealSize * ratio; } } else { width = (window.acl.leftPageWidthRealSize* ratio) + (window.acl.rightPageWidthRealSize * ratio); height = (window.acl.leftPageHeightRealSize > window.acl.rightPageHeightRealSize) ? window.acl.leftPageHeightRealSize * ratio : window.acl.rightPageHeightRealSize * ratio; } $('.zoom-size').html((ratio * 100).toFixed(0)); // Center the spread left = (wrapperWidth - width) / 2; if(left < 0){ left = 0; } top = (wrapperHeight - height)/ 2; if(top < 0){ top = 0; } // Display the result $spread.width(width); $spread.height(height); $spread.css('left', left); $spread.css('top', top);
}
var zoomIn = function(){ window.acl.currentRatio += window.acl.stepRatio; if(window.acl.currentRatio > window.acl.maxRatio){ window.acl.currentRatio = window.acl.maxRatio; } zoom(window.acl.currentRatio);
}
var fit = function() { window.acl.currentRatio = fitRatio(); zoom(window.acl.currentRatio);
}
var zoomOut = function() { window.acl.currentRatio -= window.acl.stepRatio; if(window.acl.currentRatio <= 0.0001){ window.acl.currentRatio = window.acl.stepRatio; } zoom(window.acl.currentRatio);
}
var convert_to_percentage = function (el){ var parent = el.parent(); el.css({ left:parseInt(el.css('left'))/parent.width()*100+"%", top: parseInt(el.css('top'))/parent.height()*100+"%", width: el.width()/parent.width()*100+"%", height: el.height()/parent.height()*100+"%" });
}
var convert_to_percentage_drag = function (el){ var parent = el.parent(); el.css({ left:parseInt(el.css('left'))/parent.width()*100+"%", top: parseInt(el.css('top'))/parent.height()*100+"%", });
}
var setContainerSize = function (el) { var parent = $(el.target).parent().parent(); parent.css('height', parent.height() + "px");
}
var resetContainerSize = function (el) { parent.css('height', 'auto');
}
var resizeStop = function (event, ui){ convert_to_percentage($(this));
}
var dragStop = function (event, ui){ convert_to_percentage_drag($(this));
}
var setContainerResizer = function (event, ui) { console.log($(this)[0]); $($(this)[0]).children('.ui-resizable-handle').mouseover(setContainerSize); $($(this)[0]).children('.ui-resizable-handle').mouseout(resetContainerSize);
}
$(document).ready(function(){ if(!$('.page.right').hasClass('no-page')){ $('.page.right img.full').one('load', function(){ $('.page.right').addClass('loaded'); }).each(function() { if(this.complete) { $('.page.right').addClass('loaded'); } }); } if(!$('.page.left').hasClass('no-page')){ $('.page.left img.full').one('load', function(){ $('.page.left').addClass('loaded'); }).each(function() { if(this.complete) { $('.page.left').addClass('loaded'); } }); } // Get left real image size var leftRealSize = realSize($('.left img.full')); window.acl.leftPageWidthRealSize = leftRealSize.width; window.acl.leftPageHeightRealSize = leftRealSize.height; // Get right real image size var rightRealSize = realSize($('.right img.full')); window.acl.rightPageWidthRealSize = rightRealSize.width; window.acl.rightPageHeightRealSize = rightRealSize.height; zoom(window.acl.currentRatio); $('.zoom-in').on('click', function() { zoomIn(); }); $('.fit').on('click', function() { fit(); }); $('.zoom-out').on('click', function() { zoomOut(); }); fit(); $(window).resize(function(){ // fit(); });
});
$(document).ready(function(){ $('.marker').draggable({ scroll: true, containment: ".markers", stop: dragStop }); $('.marker').resizable({ containment: ".markers", create: setContainerResizer, stop: resizeStop });
});
Developer | Adrien Clerbois |
Username | AClerbois |
Uploaded | December 30, 2022 |
Rating | 3 |
Size | 4,793 Kb |
Views | 28,336 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Viewer | 4,358 Kb |
Viewer and markers selectors v2 | 14,603 Kb |
Masonry - layoutComplete | 3,321 Kb |
MyShopi Logo animation | 2,316 Kb |
Shine Effect | 99,105 Kb |
Audi Ring animation CSS | 1,740 Kb |
A Pen by Adrien Clerbois | 6,501 Kb |
Meters | 13,192 Kb |
Windows 8 logo animation | 2,232 Kb |
Viewer and markers selectors v2 DEMO | 14,466 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Fluid Grid 12 | Alexoliverwd | 2,309 Kb |
React Template | Isac | 1,241 Kb |
Monochrome Form | AlienPiglet | 3,096 Kb |
Rainbow Drops | Csbarnes | 2,365 Kb |
A Pen by Tosh | Panev | 2,586 Kb |
CSS3 Animated buttons | Cguillou | 3,737 Kb |
CSS Dynamic Width Square Div | Elleestcrimi | 2,861 Kb |
Basic jQuery Filter list | Mtedwards | 2,464 Kb |
A Pen by Alex Bergin | Abergin | 3,347 Kb |
Long Shadow Button | Uixcrazy | 3,550 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!