1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

I couldn't find similar

Discussion in 'jQuery' started by Ferenc Cziryek, Sep 3, 2020.

?

why doesn't work the jquery fluid option for div and image?

Poll closed Sep 10, 2020.
  1. the value of resize() funcion is not transmitted , I guess

    0 vote(s)
    0.0%
  2. div and image not getting resize() values

    0 vote(s)
    0.0%
Multiple votes are allowed.
  1. #1
    Hi
    I have a problem: I try to build a flexible and responsive picture in div solution in bs 3, as I started in 2017, but it workspartially that means as I refresh the page otherwise it doesn't. the picture doesn't follow the div width changing.
    the code:
    
      var h2 = $(".city01").width();
            
         $(".city01").width(h2);
         $(".city01").height(h2);
        
         $(".imgsz").width(h2);
         $(".imgsz").height(h2);
       <!--   $(".city01").text($("#div11").width());-->
         //$(".city01").height();
         /*
         if ($(".imgsz").width() < $(".imgsz").height()) {
           $(".imgsz").height(h2);
         } else {
           $(".imgsz").width(h2);
         (*/
          $(window).resize(function(){
        
          
           h2 = $(".city01").width();
          
           //$(".city01").css({'height':(h11)+'px'});
           $("#div11").text("  width : "+ $(".city01").width ()+ "  height : "+ $(".city01").height());
         /*  
         if ($(".imgsz").width() < $(".imgsz").height()) {
           $(".imgsz").height(h11);
         } else {
           $(".imgsz").width(h11);
         }
      */
         $(".city01").width(h2);
         $(".city01").height(h2);
    https://codepen.io/cfrank2000/pen/zYqEVBB
        
         $(".imgsz").width(h2);
         $(".imgsz").height(h2);
         });
    Code (JavaScript):

     

    Attached Files:

    Last edited by a moderator: Sep 3, 2020
    Ferenc Cziryek, Sep 3, 2020 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #2
    sarahk, Sep 3, 2020 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #3
    1) what makes layout any of JavaScript's business?

    2) what makes layout any of JavaScript's business?!?

    Now I realize this is in fact only one point, bit it's such a colossal sticking point I thought it merited saying twice.

    3) <!-- --> is NOT how you comment out code in JavaScript.

    4) as @sarahk said, how / where are you calling this code? It would need to be run both at onload and at window.onresize I should think. That said, see points 1 and 2.
     
    deathshadow, Sep 7, 2020 IP
    sarahk likes this.