admin管理员组文章数量:1022670
The ultimate goal (for me) is to create a very simple gallery that is almsot exactly like this example:
EXAMPLE: .html
However, this gallery is made using Flash and I want mine to be made out of HTML, CSS & Javascript, for patability I want to avoid using Flash.
I have no trouble making the gallery itself (the images transitioning in to one another) because I can use something like this:
freelancer-id/easy-gallery/2
My main struggle I'm having is filling the page how I want it to. If you look at the example above and resize the window you will see that it does 2 key things.
- Resizes the width of the gallery to fit the width of the window 1.1. Once gallery height is reached, it horizontally centers the gallery to fit the height of the window
- Vertically centers the gallery to fit the height of the window 2.1 Once gallery width is reached, it vertically centers the gallery to fit the width of the window
Now... I have half-acplished the first objective by utilizing this piece of coding:
imgscale.kjmeath/
This works great for scaling down large images to fit the width of a containing Div. However it currently only does it when the page loads and does not change when you resize the window.
I do not know how to:
*Dynamically resize the gallery depending o nthe window size *Vertically/Horizontally center the image within the container div
If anybody has got any advice or could point me towards some tutorial or plugins which may help that would be great.
The ultimate goal (for me) is to create a very simple gallery that is almsot exactly like this example:
EXAMPLE: http://www.iheartdropdead./spring-summer-lookbook-2011.html
However, this gallery is made using Flash and I want mine to be made out of HTML, CSS & Javascript, for patability I want to avoid using Flash.
I have no trouble making the gallery itself (the images transitioning in to one another) because I can use something like this:
freelancer-id./easy-gallery/2
My main struggle I'm having is filling the page how I want it to. If you look at the example above and resize the window you will see that it does 2 key things.
- Resizes the width of the gallery to fit the width of the window 1.1. Once gallery height is reached, it horizontally centers the gallery to fit the height of the window
- Vertically centers the gallery to fit the height of the window 2.1 Once gallery width is reached, it vertically centers the gallery to fit the width of the window
Now... I have half-acplished the first objective by utilizing this piece of coding:
imgscale.kjmeath./
This works great for scaling down large images to fit the width of a containing Div. However it currently only does it when the page loads and does not change when you resize the window.
I do not know how to:
*Dynamically resize the gallery depending o nthe window size *Vertically/Horizontally center the image within the container div
If anybody has got any advice or could point me towards some tutorial or plugins which may help that would be great.
Share Improve this question edited Jun 5, 2019 at 18:56 Zoe - Save the data dump 28.3k22 gold badges128 silver badges160 bronze badges asked Jun 23, 2011 at 18:24 LesLes 311 silver badge2 bronze badges2 Answers
Reset to default 3You could do it with a Media Query. People have started to call this "responsive" design. You would simply have a different CSS sheet for different resolutions. Like this:
<link rel="stylesheet" type="text/css"
media="screen and (max-device-width: 480px)" href="style.css" />
Here's an article that explains it a bit more: http://www.alistapart./articles/responsive-web-design/
I think much of what you want could be acplished via a well-designed fluid css layout. However, for the trickier stuff know that you can use jQuery's .resize() method to bind to the window resize event and execute code accordingly.
The ultimate goal (for me) is to create a very simple gallery that is almsot exactly like this example:
EXAMPLE: .html
However, this gallery is made using Flash and I want mine to be made out of HTML, CSS & Javascript, for patability I want to avoid using Flash.
I have no trouble making the gallery itself (the images transitioning in to one another) because I can use something like this:
freelancer-id/easy-gallery/2
My main struggle I'm having is filling the page how I want it to. If you look at the example above and resize the window you will see that it does 2 key things.
- Resizes the width of the gallery to fit the width of the window 1.1. Once gallery height is reached, it horizontally centers the gallery to fit the height of the window
- Vertically centers the gallery to fit the height of the window 2.1 Once gallery width is reached, it vertically centers the gallery to fit the width of the window
Now... I have half-acplished the first objective by utilizing this piece of coding:
imgscale.kjmeath/
This works great for scaling down large images to fit the width of a containing Div. However it currently only does it when the page loads and does not change when you resize the window.
I do not know how to:
*Dynamically resize the gallery depending o nthe window size *Vertically/Horizontally center the image within the container div
If anybody has got any advice or could point me towards some tutorial or plugins which may help that would be great.
The ultimate goal (for me) is to create a very simple gallery that is almsot exactly like this example:
EXAMPLE: http://www.iheartdropdead./spring-summer-lookbook-2011.html
However, this gallery is made using Flash and I want mine to be made out of HTML, CSS & Javascript, for patability I want to avoid using Flash.
I have no trouble making the gallery itself (the images transitioning in to one another) because I can use something like this:
freelancer-id./easy-gallery/2
My main struggle I'm having is filling the page how I want it to. If you look at the example above and resize the window you will see that it does 2 key things.
- Resizes the width of the gallery to fit the width of the window 1.1. Once gallery height is reached, it horizontally centers the gallery to fit the height of the window
- Vertically centers the gallery to fit the height of the window 2.1 Once gallery width is reached, it vertically centers the gallery to fit the width of the window
Now... I have half-acplished the first objective by utilizing this piece of coding:
imgscale.kjmeath./
This works great for scaling down large images to fit the width of a containing Div. However it currently only does it when the page loads and does not change when you resize the window.
I do not know how to:
*Dynamically resize the gallery depending o nthe window size *Vertically/Horizontally center the image within the container div
If anybody has got any advice or could point me towards some tutorial or plugins which may help that would be great.
Share Improve this question edited Jun 5, 2019 at 18:56 Zoe - Save the data dump 28.3k22 gold badges128 silver badges160 bronze badges asked Jun 23, 2011 at 18:24 LesLes 311 silver badge2 bronze badges2 Answers
Reset to default 3You could do it with a Media Query. People have started to call this "responsive" design. You would simply have a different CSS sheet for different resolutions. Like this:
<link rel="stylesheet" type="text/css"
media="screen and (max-device-width: 480px)" href="style.css" />
Here's an article that explains it a bit more: http://www.alistapart./articles/responsive-web-design/
I think much of what you want could be acplished via a well-designed fluid css layout. However, for the trickier stuff know that you can use jQuery's .resize() method to bind to the window resize event and execute code accordingly.
本文标签: javascriptHow to dynamically change imagediv dimensions based on window sizeStack Overflow
版权声明:本文标题:javascript - How to dynamically change imagediv dimensions based on window size? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745543286a2155280.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论