最小幅、最大幅のjQueryハックラッパー

ハックhabrahabr.ru/blogs/webdev/68917に基づいて使用する4funによって作成された
あなたのサイトがすでにjQueryで動作している場合、別の15行の天気コードは動作しません。これは私の意見です。
jq-widthクラスを要素に追加し、min-width max-widthを使用します。 コードは、指定されたクラスの要素に中括弧を挿入します。

$( 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:金曜日の素晴らしいハックの後、「ブラウザを決定する方法」 dimox.name/html_js_browser_detection


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


All Articles