📜 ⬆️ ⬇️

jQuery hack wrapper with min-, max-width

Written by 4fun based on and using hack habrahabr.ru/blogs/webdev/68917
If your site already works with jQuery, then another 15 lines of weather code will not do, that’s my opinion.
Add jq-width to elements and use min-width max-width; the code will insert spacers to the elements of the specified class.

$( document .body).ready( function (){ $( '.jq-width' ).each( function (){ if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) ) { var jqw_max, jqw_min ; if ( ! parseFloat(jqw_max = $( this ).css( 'max-width' )) ) jqw_max = '*' ; if ( ! parseFloat(jqw_min = $( this ).css( 'min-width' )) ) jqw_min = '0' ; $( this ).wrap( '<table border="0" cellspacing="0" cellpadding="0"><tr border="0"><td border="0" width="' +jqw_max+ '"><div width="' +jqw_min+ '">' + '</div></td></tr></table>' ); } }) }); * This source code was highlighted with Source Code Highlighter .
  1. $( document .body).ready( function (){ $( '.jq-width' ).each( function (){ if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) ) { var jqw_max, jqw_min ; if ( ! parseFloat(jqw_max = $( this ).css( 'max-width' )) ) jqw_max = '*' ; if ( ! parseFloat(jqw_min = $( this ).css( 'min-width' )) ) jqw_min = '0' ; $( this ).wrap( '<table border="0" cellspacing="0" cellpadding="0"><tr border="0"><td border="0" width="' +jqw_max+ '"><div width="' +jqw_min+ '">' + '</div></td></tr></table>' ); } }) }); * This source code was highlighted with Source Code Highlighter .
  2. $( document .body).ready( function (){ $( '.jq-width' ).each( function (){ if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) ) { var jqw_max, jqw_min ; if ( ! parseFloat(jqw_max = $( this ).css( 'max-width' )) ) jqw_max = '*' ; if ( ! parseFloat(jqw_min = $( this ).css( 'min-width' )) ) jqw_min = '0' ; $( this ).wrap( '<table border="0" cellspacing="0" cellpadding="0"><tr border="0"><td border="0" width="' +jqw_max+ '"><div width="' +jqw_min+ '">' + '</div></td></tr></table>' ); } }) }); * This source code was highlighted with Source Code Highlighter .
  3. $( document .body).ready( function (){ $( '.jq-width' ).each( function (){ if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) ) { var jqw_max, jqw_min ; if ( ! parseFloat(jqw_max = $( this ).css( 'max-width' )) ) jqw_max = '*' ; if ( ! parseFloat(jqw_min = $( this ).css( 'min-width' )) ) jqw_min = '0' ; $( this ).wrap( '<table border="0" cellspacing="0" cellpadding="0"><tr border="0"><td border="0" width="' +jqw_max+ '"><div width="' +jqw_min+ '">' + '</div></td></tr></table>' ); } }) }); * This source code was highlighted with Source Code Highlighter .
  4. $( document .body).ready( function (){ $( '.jq-width' ).each( function (){ if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) ) { var jqw_max, jqw_min ; if ( ! parseFloat(jqw_max = $( this ).css( 'max-width' )) ) jqw_max = '*' ; if ( ! parseFloat(jqw_min = $( this ).css( 'min-width' )) ) jqw_min = '0' ; $( this ).wrap( '<table border="0" cellspacing="0" cellpadding="0"><tr border="0"><td border="0" width="' +jqw_max+ '"><div width="' +jqw_min+ '">' + '</div></td></tr></table>' ); } }) }); * This source code was highlighted with Source Code Highlighter .
  5. $( document .body).ready( function (){ $( '.jq-width' ).each( function (){ if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) ) { var jqw_max, jqw_min ; if ( ! parseFloat(jqw_max = $( this ).css( 'max-width' )) ) jqw_max = '*' ; if ( ! parseFloat(jqw_min = $( this ).css( 'min-width' )) ) jqw_min = '0' ; $( this ).wrap( '<table border="0" cellspacing="0" cellpadding="0"><tr border="0"><td border="0" width="' +jqw_max+ '"><div width="' +jqw_min+ '">' + '</div></td></tr></table>' ); } }) }); * This source code was highlighted with Source Code Highlighter .
  6. $( document .body).ready( function (){ $( '.jq-width' ).each( function (){ if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) ) { var jqw_max, jqw_min ; if ( ! parseFloat(jqw_max = $( this ).css( 'max-width' )) ) jqw_max = '*' ; if ( ! parseFloat(jqw_min = $( this ).css( 'min-width' )) ) jqw_min = '0' ; $( this ).wrap( '<table border="0" cellspacing="0" cellpadding="0"><tr border="0"><td border="0" width="' +jqw_max+ '"><div width="' +jqw_min+ '">' + '</div></td></tr></table>' ); } }) }); * This source code was highlighted with Source Code Highlighter .
  7. $( document .body).ready( function (){ $( '.jq-width' ).each( function (){ if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) ) { var jqw_max, jqw_min ; if ( ! parseFloat(jqw_max = $( this ).css( 'max-width' )) ) jqw_max = '*' ; if ( ! parseFloat(jqw_min = $( this ).css( 'min-width' )) ) jqw_min = '0' ; $( this ).wrap( '<table border="0" cellspacing="0" cellpadding="0"><tr border="0"><td border="0" width="' +jqw_max+ '"><div width="' +jqw_min+ '">' + '</div></td></tr></table>' ); } }) }); * This source code was highlighted with Source Code Highlighter .
  8. $( document .body).ready( function (){ $( '.jq-width' ).each( function (){ if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) ) { var jqw_max, jqw_min ; if ( ! parseFloat(jqw_max = $( this ).css( 'max-width' )) ) jqw_max = '*' ; if ( ! parseFloat(jqw_min = $( this ).css( 'min-width' )) ) jqw_min = '0' ; $( this ).wrap( '<table border="0" cellspacing="0" cellpadding="0"><tr border="0"><td border="0" width="' +jqw_max+ '"><div width="' +jqw_min+ '">' + '</div></td></tr></table>' ); } }) }); * This source code was highlighted with Source Code Highlighter .
  9. $( document .body).ready( function (){ $( '.jq-width' ).each( function (){ if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) ) { var jqw_max, jqw_min ; if ( ! parseFloat(jqw_max = $( this ).css( 'max-width' )) ) jqw_max = '*' ; if ( ! parseFloat(jqw_min = $( this ).css( 'min-width' )) ) jqw_min = '0' ; $( this ).wrap( '<table border="0" cellspacing="0" cellpadding="0"><tr border="0"><td border="0" width="' +jqw_max+ '"><div width="' +jqw_min+ '">' + '</div></td></tr></table>' ); } }) }); * This source code was highlighted with Source Code Highlighter .
  10. $( document .body).ready( function (){ $( '.jq-width' ).each( function (){ if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) ) { var jqw_max, jqw_min ; if ( ! parseFloat(jqw_max = $( this ).css( 'max-width' )) ) jqw_max = '*' ; if ( ! parseFloat(jqw_min = $( this ).css( 'min-width' )) ) jqw_min = '0' ; $( this ).wrap( '<table border="0" cellspacing="0" cellpadding="0"><tr border="0"><td border="0" width="' +jqw_max+ '"><div width="' +jqw_min+ '">' + '</div></td></tr></table>' ); } }) }); * This source code was highlighted with Source Code Highlighter .
  11. $( document .body).ready( function (){ $( '.jq-width' ).each( function (){ if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) ) { var jqw_max, jqw_min ; if ( ! parseFloat(jqw_max = $( this ).css( 'max-width' )) ) jqw_max = '*' ; if ( ! parseFloat(jqw_min = $( this ).css( 'min-width' )) ) jqw_min = '0' ; $( this ).wrap( '<table border="0" cellspacing="0" cellpadding="0"><tr border="0"><td border="0" width="' +jqw_max+ '"><div width="' +jqw_min+ '">' + '</div></td></tr></table>' ); } }) }); * This source code was highlighted with Source Code Highlighter .
  12. $( document .body).ready( function (){ $( '.jq-width' ).each( function (){ if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) ) { var jqw_max, jqw_min ; if ( ! parseFloat(jqw_max = $( this ).css( 'max-width' )) ) jqw_max = '*' ; if ( ! parseFloat(jqw_min = $( this ).css( 'min-width' )) ) jqw_min = '0' ; $( this ).wrap( '<table border="0" cellspacing="0" cellpadding="0"><tr border="0"><td border="0" width="' +jqw_max+ '"><div width="' +jqw_min+ '">' + '</div></td></tr></table>' ); } }) }); * This source code was highlighted with Source Code Highlighter .
  13. $( document .body).ready( function (){ $( '.jq-width' ).each( function (){ if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) ) { var jqw_max, jqw_min ; if ( ! parseFloat(jqw_max = $( this ).css( 'max-width' )) ) jqw_max = '*' ; if ( ! parseFloat(jqw_min = $( this ).css( 'min-width' )) ) jqw_min = '0' ; $( this ).wrap( '<table border="0" cellspacing="0" cellpadding="0"><tr border="0"><td border="0" width="' +jqw_max+ '"><div width="' +jqw_min+ '">' + '</div></td></tr></table>' ); } }) }); * This source code was highlighted with Source Code Highlighter .
$( document .body).ready( function (){ $( '.jq-width' ).each( function (){ if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) ) { var jqw_max, jqw_min ; if ( ! parseFloat(jqw_max = $( this ).css( 'max-width' )) ) jqw_max = '*' ; if ( ! parseFloat(jqw_min = $( this ).css( 'min-width' )) ) jqw_min = '0' ; $( this ).wrap( '<table border="0" cellspacing="0" cellpadding="0"><tr border="0"><td border="0" width="' +jqw_max+ '"><div width="' +jqw_min+ '">' + '</div></td></tr></table>' ); } }) }); * This source code was highlighted with Source Code Highlighter .



PS: in pursuit of the excellent Friday hack "how to determine the browser" dimox.name/html_js_browser_detection

')

Source: https://habr.com/ru/post/69354/


All Articles