1d
comment Scaling an image to best fit the viewport
You shouldn't post a brand new answer when you need to make a small change. You can simply edit your existing answer. I would suggest deleting one of these answers.
1d
comment Scaling an image to best fit the viewport
@Mike the code in your jsbin is different than in the question. The part screwing up your aspect ratio is that youv'e changed whether you multiply or divide by aspectRatio. They were right in the question.
1d
comment Scaling an image to best fit the viewport
@Mike Example added, seems fine to me.
1d
revised Scaling an image to best fit the viewport
added 358 characters in body
1d
comment Scaling an image to best fit the viewport
I don't see how that if could affect your aspect ratio. It's not part of the calculation.
1d
answered Scaling an image to best fit the viewport
1d
comment Scaling an image to best fit the viewport
@elclanrs That would only handle the "too wide" situation, not the too tall.
Jul
25
revised Add attribute not working in jquery
Separating the code allows for proper syntax highlighting of both blocks.
Jul
25
comment Spliting an html content based on a html tag
$(temp).children("img") is probably slightly better as images within nested elements won't work right.
Jul
25
answered Spliting an html content based on a html tag
Jul
25
revised Spliting an html content based on a html tag
deleted 23 characters in body
Jul
25
comment why do we give height 100% to our body and html?
From MDN when talking about percentage heights: "If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, the value computes to auto."
Jul
25
comment why do we give height 100% to our body and html?
Slight correction. The calculated height of body is not relevant. If there is content, the body will have a calculated height. However, percentage height will not use a calculated height, it only works with a defined height.
Jul
25
comment why do we give height 100% to our body and html?
Won't mark as duplicate because it's not a direct duplicate, but the answer to this question answers yours perfectly. stackoverflow.com/questions/7049875/height100-not-working
Jul
24
awarded Critic
Jul
24
comment Javascript array into function not work
See the non-jquery answer on this question stackoverflow.com/questions/14220321/…
Jul
24
revised Javascript array into function not work
added 248 characters in body
Jul
23
comment Javascript regex doesn't match
You missed one slash. The / before /img is still improperly escaped. Though it doesn't cause a problem since / doesn't need to be escaped at all.
Jul
23
comment Javascript regex doesn't match
@helmet91 Just adding the RegExp constructor couldn't have fixed your problem. If it worked then you must have fixed the improper escaping in your string as well.
Jul
23
comment Javascript regex doesn't match
If a non-RegExp object obj is passed, it is implicitly converted to a RegExp by using new RegExp(obj). String.prototype.match
1 2 3 4 5