Skip to content

Instantly share code, notes, and snippets.

@pongstr
Last active December 17, 2015 15:29
Show Gist options
  • Save pongstr/5632103 to your computer and use it in GitHub Desktop.
Save pongstr/5632103 to your computer and use it in GitHub Desktop.
Bootstrap Thumbnails Fix http://jsfiddle.net/Pongstr/GSgBp/
.thumbnails > li.span2:nth-child(6n+1),
.thumbnails > li.span3:nth-child(4n+1),
.thumbnails > li.span4:nth-child(3n+1),
.thumbnails > li.span6:nth-child(2n+3){ margin-left: 0 !important; }
$(window).load(function(){
/*!
* Please make sure you have conditional ie tags at the beginning
* of your html otherwise this script will not work e.g.,
*
* <!doctype html>
* <!--[if IE 7]><html class="no-js lt-ie9 lt-ie8"><![endif]-->
* <!--[if IE 8]> <html class="no-js lt-ie9"><![endif]-->
* <!--[if gt IE 8]><!--><html class="no-js"><!--<![endif]--><head>
*
*/
"use strict";
// Don't break function
function dontBreak( column ){
var ie7 = '.lt-ie8' + ' .thumbnails > ' + column,
ie8 = '.lt-ie9' + ' .thumbnails > ' + column;
$( ie7, ie8 ).css({ 'margin-left' : '0' });
}
if ( $('.lt-ie9 .thumbnails', '.lt-ie8 .thumbnails').length > 0 ) {
// Don't break .span2
dontBreak('.span2:nth-child(6n+1)');
// Don't break .span3
dontBreak('.span3:nth-child(4n+1)');
// Don't break .span4
dontBreak('.span4:nth-child(3n+1)');
// Don't break .span26
dontBreak('.span6:nth-child(2n+3)');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment