Is there any plugin for jQuery that would take an argument for the max length of a field and then size the width of the same field in respect to it?
Calculating the width depending on the field size is not possible, since different letters have different sizes (compare i and w). A possibility would be to take the size and multiply with the width of a w, but then the field would become very/too big. It also depends on font settings and I am unsure about possibilities to get font dimensions from JavaScript.
Taking this in mind: I do not think there are any (good) working plugins for jQuery out there... But maybe someone else is able to prove me wrong?
Related
I'm fairly new to scss, I'm trying to make a variable that has the minimum value of 10 percent view height and 10 percent view width.
my approach is
$size = min(10vh, 10vw);
But I would get unit not comparable error.
How would I solve such issue? Thanks in advance
I think that this can't be done.
At transpile time SASS doesn't know what the height and the width of the viewport are gonna be (think about the change of orientation of a tablet). That information is only available on the client device.
This can't be done in CSS either (there is no max or min function), see Calc of max, or max of calc in CSS
I have a lot of many mobile screen standard.Example :
240x320
320x480
480x800
........
But in log i received many screen size (This screen size was detected by javascript then send to the webserver, when device access my website) :example 241x322, 239x320, 481x799 ... This size was wrong any pixel at height , weight or both of height and weight
What is the best of algorithm, or library to normalize screen size (know size 241x322 is 240x320).
You could run a simple algorithm that searches for the closest match, and change to that.
Run a loop looking for the distance (absolute value) from all heights / weights, and get the min one.
If you do them in ascending/descending order, you can break once you see the changes grow to improve efficiency.
You could also make sure the aspect radio is right as a measure of extra safety.
I'm doing a bar chart with google, and my results look like this (link).
If you see that the graph is not beautiful enough. What is the parameter that can reduce the value on the x axis.
Thank you in advance.
try this one
I just added chds=0,10 to scale it properly. That basically sets the data range to 0 min, 10 max.
I would take a look at this link from google regarding Data Scaling. I am not sure of your data set format so the actual answer to your problem will depend on that.
i.e. - I added "&chds=0,10" after your "chd=" statment and got a better looking chart. Example.
Check out the help file here.
Decide whether your data must be scaled to fit your chart. Different formats support different ranges of values. You might want to scale your data so that it spans the full range of values allowed by your format, to make differences more obvious. You can do this either by scaling your data to fit within the data format that you use, or you can use text formatting with custom scaling.
What are the use cases for defining distances in a web layout for pixels and percentages?
Is there any downside to using pixels with respect to multiple resolutions? Will they scale correctly?
Percentage layout
This is generally referred to as fluid layout. Your elements will take a defined percentage of the total space available to them. This available space is determined by the element's parent.
When using percentage layouts, it's a good idea to specify a min-width and max-width on your design so that it remains usable at very low and high resolutions.
Pros
Scales with screen size, therefore get to use more space if it's available.
Cons
Makes it more difficult to know the exact position of something on screen. As a result, it can make creating precise layouts more difficult.
Can lead to unexpected layouts if child elements are fixed width (i.e. an image) and end up being larger than their fluid width parent.
Pixel layout
This is usually known as fixed layout. Your element will always be the same defined pixel size and will not take available parent space into account.
Pros
Always know an element's exact size.
Creating precise layout is easier.
Cons
You don't scale with resolutions. Your layout will always be the same width, making for wasted space when people have high resolutions.
I'll reply to this one by telling you a true story.
We had a client which wanted a map view, made up of divs.
Suddenly, he decided he wanted zooming as well.
I had to change all those fine-grained pixel positions to percentages.
Causing the wrapping div to change width/height (in pixels) relatively, we got a nice and reasonable zooming effect.
NB: During design phase, I quickly drew up a prototype, I'm going to look it up for you...
Edit: Nope, nothing found, sorry.
For percentages you have to have a base value, so it would be something like an image that has a size set outside of the CSS, if you just use a percentage on a DIV, for example, it wouldn't have anything to base that off of except the actual size it was by its being filled with text, for example, so it would not be practical to use percentages as a way to size it as it would rarely produce the desired output, if you are re-sizing something with a pixel size, such as by using javascript, you could resize by a percentage that would resize the original value (in pixels)
They do different things.
Pixel values always relate to hypothetical pixels on the output device.
Percent values relate to the computed size of the containing block (for block elements) or the containing block's font size (for font sizes).
Em and pt values relate to the current font size.
If you want your item to scale with its container, use percentages. If you want it to scale with font size, use ems. If you don't want it to scale at all, use pixels.
And then there's IE6; whoever 'implemented' CSS in that thing obviously had no idea what the various CSS properties were supposed to do.
Be careful using percentages, webkit browsers don't calculate percentages correctly. It's all because webkit doesn't calculate subpixels correct.
Detailed information about this issue can be read here: Percentage bugs in webkit
I would recommend you to always use pixels to don't have any layout dimensions differences between browsers.
I've been meaning to ask this question for a while.
It appears that if I want to set a maximum width of a form then I have to set a maximum height as well.
Is this right?
If so, which of the multitude of variables do I use, in this situation, to set the maximum form height to the height of the window?
Screen.PrimaryScreen.Bounds?, Screen.GetWorkingArea(New Point(0, 0))?
Eta: From further investigation, I think PrimaryScreen.Bounds and GetWorkingArea are the same.
Also, having thought a little more, should I put Int32.MaxValue into the height property instead of the max height of the window?
Yes, you do have to set the max width and height together using a Size instance. If you do not want to limit one of the dimensions, you might want to consider using System.Windows.Forms.SystemInformation.MaxWindowTrackSize to get the max for the "unlimited" dimension.