javascript - ccs3 property backgroundsize:cover mechanism -


I've used background size: the image is covered to work perfectly but the problem is that Size of any screen for how to get it after the image size.

I want to calculate the height and width of the image provided, I have the original image height and width, the screen size with me

  var screenview = 1366; // Screen width or element needs to show var screen = h = 768; // Height is required to show the var or wreal = 800 to the original image; // Original Image Width var Original ImageHit = 600; // Original image height vertical background, background, background; // default scale by the height of the screen background; Light = screen; BackgroundWidth = BackgroundHight * Original Image Image / Original SixSite; If ((screenwidth - backgroundwidth)> gt; {// if the width of the tile images is a small screen show, then the width starting from the breadth width is Width = ScreenWidth; BackgroundHigh = screenwidth * Original ImageHight / Original Image Wide; }  

Then use the CSS background-size percent

  $ (element) .css ({"background-size": (backgroundWidth + "px "+" "+ BackgroundHeight +" pixels ")});  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -