Scrolls to last "scroll position". Uses localStorage.
<a href="javascript:(function(){var v="1.3.2";if(window.jQuery===undefined||window.jQuery.fn.jquery<v){var done=false;var script=document.createElement("script");script.src="http://ajax.googleapis.com/ajax/libs/jquery/"+v+"/jquery.min.js";script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;initMyBookmarklet();}};document.getElementsByTagName("head")[0].appendChild(script);}else{initMyBookmarklet();}function initMyBookmarklet(){(window.myBookmarklet=function(){jQuery(".nextProda").live("click",function(){if(typeof(localStorage)=='undefined'){alert('Ваш браузер не поддерживает localStorage()');}else{jQuery(document).scrollTop(localStorage.getItem('scroll'+encodeURIComponent(window.location.pathname)));}return false;});jQuery("body").append('<a href="#" class="nextProda" style="background-color:rgb(190,111,98);display:block;left:0;position:fixed;top:50%;width:90px;padding:8px;text-align:center;color:#fff;border-radius:0 10px 10px 0">Продолжить чтение</a>');jQuery(window).scroll(function(){if(typeof(localStorage)!='undefined'){if(jQuery(".nextProda").length>0){jQuery(".nextProda").width('20px').html('Zz..').css('font-size','10px');}try{localStorage.setItem('scroll'+encodeURIComponent(window.location.pathname),jQuery(document).scrollTop());}catch(e){if(e==QUOTA_EXCEEDED_ERR){}}}});})();}})();" id="codeOut">Продолжить чтение</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment