Skip to content

Instantly share code, notes, and snippets.

@sibaberpollo
Last active January 25, 2016 19:26
Show Gist options
  • Save sibaberpollo/33c3cf1dadd47c56e616 to your computer and use it in GitHub Desktop.
Save sibaberpollo/33c3cf1dadd47c56e616 to your computer and use it in GitHub Desktop.
consulta
var first_time = true;
$(document).ready(function () {
updateContainer();
$(window).resize(function() {
updateContainer();
console.log(first_time);
});
});
function updateContainer() {
var width = $(window).width();
if (width <= 768 && first_time == true) {
$(".tabs #linea-rota").each(function() {
var html = $(this).html().split(" ");
html = "<br>" + html[0] + "<br>" + html.slice(1).join(" ");
$(this).html(html);
first_time = false;
});
}
if (width > 769 && first_time == false) {
$('.tabs #linea-rota').find('br').remove();
//first_time=null;
}
}
@p1nox
Copy link

p1nox commented Jan 25, 2016

var width = $(window).width();
if (width <= 768) {
  $(".tabs #linea-rota").each(function() {
    var $el = $(this);
    if (!$el.find('br').length) {
      var html = $(this).html().split(" ");
      html = "<br>" + html[0] + "<br>" + html.slice(1).join(" ");
      $(this).html(html);
    }
  });
} else {
  $('.tabs #linea-rota').find('br').remove();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment