Toggle navigation
Document
Download
Keep Position
:: jQuery Utility Kit
$( link | form ).keepPosition()
ページ切替時、スクロール位置が保持されます
Home
Profile
Messages
Query String is
var q = location.search; $('.query-string').text(q || 'none'); var search = q || '?home'; $('ul.nav-tabs li').each(function(){ var t = $(this), a = t.find('> a'); a.prop('search') != search || t.addClass('active'); }); // keep position $('ul.nav-tabs a').keepPosition();
.contents{ margin:16px; }
Query String is
$('.query-string').text(location.search || 'none'); $('input.form-control').val(location.search.replace(/^.*sample-val=/,'')); $('form.sample').keepPosition();
form.sample{ padding: 16px; border: solid 1px #e0e0e0; border-radius: 4px; background:#f0f0f0; }
データ編集後、スクロール位置を保持したままページをリロードします。
No
Value
#1
#2
#3
//Easy Table Editor var tableEditor = (function(){ var callee = arguments.callee; var editor = $('
'). on('keydown', function(e){ if(e.keyCode == 13){ $.cookie('v' + editor.data('edit-index'), editor.val()); callee.onSave(); } if(e.keyCode == 27) editor.hide(); }).prependTo( $('body').on('click','a.edit',function(){ var t = $(this); editor.data('edit-index', t.data('index')).val(t.text()). show().select(); }) ); return $.extend(callee, { bind : function(table){ $(table).find('tbody tr').each(function(i){ $(this).find('.edit').data('index', i). text($.cookie('v'+i)||'(none)'); }); return callee; }, onSave : function(f){ callee.onSave = f; return callee; } }); })(); //bind tableEditor.bind('table').onSave(function(){ //keep position $.keepPosition.reload(); });
.editor{ position:fixed; z-index:99999; top:45%; left:35%; width:30%; height:50px; border-width:5px; display:none; } .edit{ cursor: pointer; }