Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Web development simple question

Options
  • 21-01-2017 6:30pm
    #1
    Closed Accounts Posts: 191 ✭✭


    Hey can anyone tell me why my images wont change size when i change the height? Thanks for your help.

    [HTML]
    <div class="container">

    <div id="myCarousel" class="carousel slide">
    <!-- Indicators -->
    <ol class="carousel-indicators">
    <li class="item1 active"></li>
    <li class="item2"></li>
    <li class="item3"></li>
    <li class="item4"></li>
    </ol>

    <!-- Wrapper for slides -->
    <div class="carousel-inner" role="listbox">

    <div class="item active">
    <img src="images/homeIMG1.jpg" width="100%" height="900px">
    <div class="carousel-caption">
    </div>
    </div>

    <div class="item">
    <img src="images/homeIMG2.jpg" alt="Chania" width="100%" height="420px">
    <div class="carousel-caption">
    </div>
    </div>

    <div class="item">
    <img src="images/homeIMG3.jpg" alt="Flower" width="100%" height="500">
    <div class="carousel-caption">

    </div>
    </div>

    <div class="item">
    <img src="images/homeIMG4.jpg" alt="Flower" width="100%" height="400>
    <div class="carousel-caption">

    </div>
    </div>

    </div>


    </div>
    </div>

    <script>
    $(document).ready(function(){
    // Activate Carousel
    $("#myCarousel").carousel();

    // Enable Carousel Indicators
    $(".item1").click(function(){
    $("#myCarousel").carousel(0);
    });
    $(".item2").click(function(){
    $("#myCarousel").carousel(1);
    });
    $(".item3").click(function(){
    $("#myCarousel").carousel(2);
    });
    $(".item4").click(function(){
    $("#myCarousel").carousel(3);
    });

    // Enable Carousel Controls
    $(".left").click(function(){
    $("#myCarousel").carousel("prev");
    });
    $(".right").click(function(){
    $("#myCarousel").carousel("next");
    });
    });
    </script>
    [/HTML]


Comments

  • Moderators, Technology & Internet Moderators Posts: 11,015 Mod ✭✭✭✭yoyo


    Does it work using inline css? i.e: style="min-height: 900px; height: 900px; max-height: 900px;"? also check the CSS for the item class, maybe height is set in there?

    Nick


  • Registered Users Posts: 778 ✭✭✭pillphil


    <div class="item">
            <img src="images/homeIMG3.jpg" alt="Flower" width="100%" [B]height="500">[/B]<!-- no unit -->
            <div class="carousel-caption">
              
            </div>
          </div>
    
          <div class="item">
            <img src="images/homeIMG4.jpg" alt="Flower" width="100%" [B]height="400>[/B] <!-- missing closing quote and unit-->
            <div class="carousel-caption">
    


    See inline comments

    Hmm, maybe not. Works fine for me without them too.


  • Closed Accounts Posts: 191 ✭✭chocolate boy123


    Thank you I'll be sure to check !


  • Registered Users Posts: 778 ✭✭✭pillphil


    Looks like I was wrong


  • Registered Users Posts: 3,023 ✭✭✭Fukuyama


    Is this a direct copy paste of your html code?

    The second two height attributes are missing 'px' sizing and closing double-quotes (") which would be causing havoc in your divs (interpreting the closing '>' ) as part of the attribute value etc.

    If not:

    Does it work if you leave out the width attribute?


  • Advertisement
  • Closed Accounts Posts: 9,700 ✭✭✭tricky D


    Firstly as Fukuyama says, fix/validate the code.

    Secondly try not to use % for image dimension attributes. While it might work fine, it's very inelegant imho.

    Thirdly, we can't be sure if there is some css or the like affecting dimensions without more of the page's code.


  • Closed Accounts Posts: 191 ✭✭chocolate boy123


    Just as an update I have it working thanks for the responses !


Advertisement