js dom mobile code example

Example: js dom for mobile

// If the screen is wide enough that we want 3 columns
  if($(window).width() >= 770)
  {
  // Create the indent
  $("#front_items").css(
  {
  'margin-top': '-5px',
  'margin-left': '20px'
  });
  
  // Size the columns
  var textWidth = ($("#carousel").width() - 70) / 3;
  $(".front_column").css(
  {
  'width': textWidth + 'px',
  'margin-bottom': '0'
  });
  }
  // One column interface
  else
  {
  $("#front_items").css(
  {
  'margin-top': '0',
  'margin-left': '0'
  });
  
  textWidth = $("#carousel").width() + 20;
  $(".front_column").css(
  {
  'width': textWidth + 'px',
  'margin-bottom': '5px'
  });
  }