Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript container.style.width = containing element + padding

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #45956
    ralphsmouse
    Participant

    I have a container that I want resized to whatever the size of screen. I also want it to stay centered. The only way I can figure is to change the container to the size of its containing element plus its padding.

    This is all I’ve got.

    var container = document.getElementById(“container”);
    var $entry = $(‘.entry’);
    container.style.width =

    #140949
    ralphsmouse
    Participant

    I want something like this.

    var new_entry_width = thumbWidth * thumbCols – thumbWidth – 60;

    if(new_entry_width != $(“#container”).width()) {
    var items_width = (windowWidth < thumbWidth * minCols) ? (thumbWidth * minCols) : (thumbWidth * thumbCols);
    if(thumbWidth > 100) {
    $(“#container”).css(“width”, items_width);
    }
    }
    }

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.