www.webdeveloper.com
Results 1 to 7 of 7

Thread: Trouble with images being responsive

  1. #1
    Join Date
    Aug 2012
    Posts
    4

    Trouble with images being responsive

    I am having a couple issues on this portfolio site that I am in the middle of making.

    http://jdwdb.com/seb/
    This is the site that I am working on. If you click on the menu on the left, images should pop up horizontally. As you can see, I have tried a couple different methods. I need the photographs to grow/shrink according to the size of the browser window.

    www.tomhoops.com
    I am using this site as a reference. I love how fluid the images shift and I am trying to recreate that effect. I am even fine with media queries, even though the fluid responsiveness is a lot more attractive.

    Any help would be very much appreciated!

    thanks!!!

  2. #2
    Join Date
    Aug 2012
    Posts
    13
    "I need the photographs to grow/shrink according to the size of the browser window."

    You could do something like this, if ur using PHP..
    PHP Code:
    $PictureWidth 100 $numberOfPictures.'%'
    <img src="" style="width:<?= $PictureWidth;?>" />

  3. #3
    Join Date
    Mar 2012
    Posts
    3,964
    You can do that by setting:

    position=fixed;
    top=0;
    bottom=0;
    left=0;
    right=0;

    I've used zeros, which should fill the parent div. Trouble is, it does not keep the aspect ratio correct, which looks odd. To expand/contract AND keep the aspect ratio you need to use JavaScript, which I cannot help with. I just use a fixed size graphic with a low z-index (e.g. -1) and attach it to one corner. E.g.

    position:fixed;
    left=170px; /* allow for menu bar */
    top=80px; /* allow for header */
    z-index=-1; /* hide overflow to right and or below */

  4. #4
    Join Date
    Mar 2011
    Posts
    1,252
    Use a percentage ('&#37;') for the CSS height setting for #photostrip instead of the fixed setting of '830px'. That way it will be a percentage of it's container (probably the window/viewport - I didn't look that closely), and the images in your <ul> should resize correspondingly since they're set to '100%'.

    Note that you should correct the syntax on the page. The values for several attributes on your HTML elements are terminated with a semi-colon (';'). HTML attributes should either have no terminator, or (best practice) enclosed in single or double quotation marks. Good luck!
    Rick Trethewey
    Rainbo Design

  5. #5
    Join Date
    Mar 2012
    Posts
    3,964
    Quote Originally Posted by rtrethewey View Post
    Use a percentage ('&#37;') for the CSS height setting for #photostrip instead of the fixed setting of '830px'. That way it will be a percentage of it's container (probably the window/viewport - I didn't look that closely), and the images in your <ul> should resize correspondingly since they're set to '100%'.
    Making the height a percentage will not preserve the aspect ratio of the pictures. The easiest way to do that is to use a div as a re-sizeable view port onto a static picture that matches the largest size that is required. E.g. to fill an HD screen that has a 170 pixel side menu, a 150 pixel top bar and a 90 pixel footer you need a 1750x840 picture. Set overflow=hidden or set the z-index to hide the overflow, and the viewable area can expand and contract without affecting the aspect ratio of the picture.

    Note: When using large pictures, it is particularly important to optimize them. Unoptimized, a picture that size can be 400KBytes+. That can often be optiimized down to 100 to 150 KBytes (or less).
    Last edited by jedaisoul; 09-03-2012 at 01:33 AM.

  6. #6
    Join Date
    Mar 2011
    Posts
    1,252
    It was obviously too much to hope that my suggestion would fix everything, I suppose. All I had in mind was something simple like this:
    Code:
    <!DOCTYPE html>
    <head>
    <title>Responsive Image Height</title>
    <style type="text/css">
     html,body { width:100&#37;; height:100%; }
     #container { width:90%; height:90%; margin:4% auto; }
     .slide { height:100%; }
    </style>
    </head>
    <body>
    <div id="container">
    <img src="http://jdwdb.com/seb/wp-content/uploads/2012/08/MG_6736_rgb-copy.jpg" class="slide" alt="" />
    </div>
    </body>
    </html>
    Rick Trethewey
    Rainbo Design

  7. #7
    Join Date
    Mar 2012
    Posts
    3,964
    An example of what I'm suggesting is here: http://www.emberwebsites.co.uk/

    Select the "Full" and "Small" options under "Graphics Demo", and increase and decrease the window to see the effect.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.16705 seconds
  • Memory Usage 2,909KB
  • Queries Executed 15 (?)
More Information
Template Usage (35):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_code
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (7)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (73):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates