GithubHelp home page GithubHelp logo

jwindowcrop's Introduction

Description

Easy to use jQuery plugin for zoom & pan image cropping.

Differences from original fork

We moved the zoom controls below the image instead of letting them float on top of the image

Demo

Visit: http://www.tmatthew.net/jwindowcrop

Usage

// minimum
$('img.crop_me').jWindowCrop();

// typical
$('img.crop_me').jWindowCrop({
	targetWidth:300,
	targetHeight:300,
	onChange: function(result) {
		console.log($(this).attr('id'));
		console.log('x: '+result.cropX);
	}
});

Options

Option Type Default Required Description
targetWidthinteger320no Width in pixels of the cropping window
targetHeightinteger180no Height in pixels of the cropping window
onChangefunctionfunction(){}no Callback function that gets called whenever the values change. cropX, cropY, cropW, cropH, mustStretch (boolean) values are passed to this function in a hash. Use the this keyword in the function for a reference to the element that was updated.
zoomStepsinteger10no Number of incremental zoom steps. With the default of 10, you have to click the zoom-in button 9 times to reach 100%.
loadingTextstring"Loading..."no Text (can be HTML) to display within frame until image is loaded.
smartControlsbooleantrueno If true, controls will hide on mouseleave and appear on mouseenter.
showControlsOnStartbooleantrueno If true, controls will be hidden on start. Note: Do not set both this and smartControls to false.

Advanced

The structure for this plugin comes from http://starter.pixelgraphics.us/. An object is created for each dom element jWindowCrop is initialized on. A reverse reference to that object can be accessed like so:

var jwc = $('img#beach').getjWindowCrop();

You then have access to all the properties and methods used for that specific element.

Questions

Email tyler at tmatthew dot net

jwindowcrop's People

Contributors

tybro0103 avatar

Watchers

Josh Susser avatar Kevin Fitzpatrick avatar Chris Patton avatar Chris Trinh avatar Oliver Sanford avatar Alexis de Treglode avatar  avatar James Cloos avatar Matthew Stolley avatar Nathan Haugo avatar Imogen Kinsman avatar Moises Ramirez avatar Alejandro Cantarero avatar  avatar Snelson avatar Robby avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.