Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nelson 94 posts 246 karma points
    Apr 14, 2016 @ 09:26
    Nelson
    0

    Image Rendering in IE

    Hi guys,

    I've been testing my website mainly with Google Chrome, and it happens that today I tried it with firefox and IE. With Firefox everything is fine, but with IE most of my images get resized to the original image size (from the file). That happens with my partial views. Here is my code:

    @inherits UmbracoViewPage<Lecoati.LeBlender.Extension.Models.LeBlenderModel>
    
    @foreach(var item in Model.Items) 
    {
        <ul class="caption-style-1">
            <a [email protected](item.GetValue<string>("newPage")).Url>
                <li> 
                    <img [email protected](item.GetValue<string>("photo")).Url width="100%" height="100%"/>
                    <div class="caption">
                        <div class="blur-profile"></div>
                        <div class="caption-text-profile">
                            <div class="name">@Html.Raw(item.GetValue("name"))<br></div>
                            <div class="job-title">@Html.Raw(item.GetValue("title"))</div>
                        </div>
                    </div>
                </li>
            </a>
        </ul>
    }
    

    And here is my CSS:

    .caption-style-1 {
        max-width:100%;
        max-height:100%;
        list-style-type: none;
        margin: 0px;
        padding: 0px;
    }
    
    .caption-style-1 li {
        max-width:100%;
        max-height:100%;
        float: left;
        padding: 0px;
        position: relative;
        overflow: hidden;
    }
    
    .caption-style-1 li:hover .caption {
        max-width:100%;
        max-height:100%;
        opacity: 1;
    }
    
    .caption-style-1 img {
        zoom:2;
        max-width:100%;
        max-height:100%;
        margin: 0px;
        padding: 0px;
        float: left;
        z-index: 4;
    }
    
    .caption-style-1 .caption {
        width:100%;
        height:100%;
        cursor: pointer;
        position: absolute;
        opacity: 0;
        -webkit-transition: all 0.45s ease-in-out;
        -moz-transition: all 0.45s ease-in-out;
        -o-transition: all 0.45s ease-in-out;
        -ms-transition: all 0.45s ease-in-out;
        transition: all 0.45s ease-in-out;
    }
    
    .caption-style-1 .blur-profile {
        border-radius: 50%;
        width:100%;
        height:100%;
        background-color: rgba(64,189,179,0.8);
        z-index: 5;
        position: absolute;
    }
    
    .caption-style-1 .blur {
        width:100%;
        height:100%;
        background-color: rgba(64,189,179,0.8);
        z-index: 5;
        position: absolute;
    }
    
    .caption-style-1 .caption-text-profile {
        z-index: 10;
        color: #fff;
        position: absolute;
        vertical-align: middle; 
        text-align: center;
        padding: 40% 0 0 5%;
    }
    
    .caption-style-1 .caption-text {
        padding: 0 25px 0 0;
        z-index: 10;
        color: #fff;
        position: absolute;
        text-align: left;
    }
    

    Any idea about how is this happening?

    Thank you very much!

  • Martin Almström 33 posts 159 karma points
    Apr 14, 2016 @ 09:44
    Martin Almström
    0

    Hi Nelson,

    This has nothing to do with Umbraco but with your markup/css.

    Tip:

    • Remove width/height from the img-eleent.
    • .caption-style-1 img <-- might be the culprit.

    Regards,

    Martin

  • Nelson 94 posts 246 karma points
    Apr 14, 2016 @ 09:54
    Nelson
    0

    I wasnt sure so I asked here. I tried what you mentioned but the problem persists

    But thanks for helping

  • Steve Morgan 1349 posts 4459 karma points c-trib
    Apr 14, 2016 @ 09:56
    Steve Morgan
    0

    Hi Nelson,

    Looks like you have malformed HTML which is why you're seeing differences on the browsers.. look at this line:

    <img [email protected](item.GetValue<string>("photo")).Url width="100%" height="100%"/>
    

    You need to surround the src attribute in quotes...

    <img src="@(Umbraco.TypedMedia(item.GetValue<string>("photo")).Url)" width="100%" height="100%"/>
    

    Also, I'm not entirely sure but for inline width and height attributes on the img tags I don't believe percentages are valid - do this in your CSS (e.g. remove these!).

  • Steve Morgan 1349 posts 4459 karma points c-trib
    Apr 14, 2016 @ 10:00
    Steve Morgan
    0

    Also you need to do the same for:

    <a [email protected](item.GetValue<string>("newPage")).Url>
    

    e.g.

    <a href="@(Umbraco.TypedContent(item.GetValue<string>("newPage")).Url)">
    

    Notice how I add brackets around the inline razor - this is to "help" the Razor script know where the tag ends.

    Not quite sure what you're doing with that newPage string.. I would think some kind of link picker would be better or if the items are child nodes then even just a item.Url ...

  • Nelson 94 posts 246 karma points
    Apr 18, 2016 @ 09:08
    Nelson
    0

    Hello Steven, I tried both your recommendations but I still have the same issue. Dont really know how to fix this because it works perfectly in Google Chrome and Firefox. Any other idea?

    Thank you very much for your help

  • Steve Morgan 1349 posts 4459 karma points c-trib
    Apr 18, 2016 @ 10:39
    Steve Morgan
    0

    Hi Nelson,

    Bit hard to see what's going wrong exactly - is this some kind of carousel you're outputting? Your razor has a few issues but as Martin notes your specific problem is likely in the CSS.

    What version of IE are you seeing issues in - all of them or just a certain version?

    I suspect it's the use of max-width - there are some issues with this in IE8 especially. Is this on a publicly accessible URL or just on your local machine?

  • Nelson 94 posts 246 karma points
    Apr 19, 2016 @ 05:13
    Nelson
    0

    Hi Steve,

    After a lot of search, I finally solved the issue. Just added "display: block" at the img div in css and worked perfectly.

    But thanks anyway for all your support! Have a great day!

Please Sign in or register to post replies

Write your reply to:

Draft