Added ability to specify units as "pixels" or "percentage"#16
Open
bcole808 wants to merge 1 commit intokentor:masterfrom
Open
Added ability to specify units as "pixels" or "percentage"#16bcole808 wants to merge 1 commit intokentor:masterfrom
bcole808 wants to merge 1 commit intokentor:masterfrom
Conversation
|
Are there plans to get this merged? Would be backwards compatible if "px" is defaulted if no units are passed in. This is important for my use case, where a dragged picture's position changes significantly if the |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Great jQuery plugin!
I am using block elements with an intrinsic aspect ratio in order to display responsive image spaces where the user has adjusted the image position using this jQuery plugin.
Problem
Background images positioned using pixels and
background-size: coveronly look correct when the image container remains exactly the same size.Solution
Using percentages for background position allows the background to be in the correct space, regardless of element size.
Implementation
The code I added to the plugin adds an option called
unitswhich lets the developer specify "pixels" or "percent" and if percent is configured then the plugin will convert to percent before applying the styles.