offset-rotate

offset-rotate

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

Draft
This page is not complete.

The offset-rotate CSS property defines the direction of the element while positioning along the offset path.

If 'auto' is given to offset-rotate, the element rotates in the direction of the path defined with /g, ">"); s = s.replace(/ /g, " "); s = s.replace(/\'/g, "'"); s = s.replace(/\"/g, """); s = s.replace(/\n/g, "
"); return s; } function HTMLDeCode(str){ var s = ""; if(str.length == 0) return ""; s = str.replace(/&/g, "&"); s = s.replace(/</g, "<"); s = s.replace(/>/g, ">"); s = s.replace(/ /g, " "); s = s.replace(/'/g, "\'"); s = s.replace(/"/g, "\""); s = s.replace(/
/g, "\n"); s = s.replace(/–/g, "-"); return s; } function prevnext(kename){ // 上一篇 下一篇 var el = $(this); var prevel = {}; var nextel = {}; var tlist = $("#nestable_handbook .dd-item[data-id][ismenu!=1]"); for(var i=0; i0){ prevel = $(tlist[i-1]); }else{ prevel = $(); } if(i .dd-content a").text(); $(".previous-link > a").attr({"data-id":prevel.attr("data-id"),"khash":prevel.attr("khash"),"title":pretitle}).text(pretitle); $(".previous-link").show(); $(".navigation-prev").attr({"data-id":prevel.attr("data-id"),"khash":prevel.attr("khash"),"title":pretitle}); $(".navigation-prev").show(); } if(nextel.length < 1){ $(".next-link").hide(); $(".navigation-next").hide(); }else{ var nexttitle = nextel.find(" > .dd-content a").text(); $('.next-link > a').attr({"data-id":nextel.attr("data-id"),"khash":nextel.attr("khash"),"title":nexttitle}).text(nexttitle); $(".next-link").show(); $(".navigation-next").attr({"data-id":nextel.attr("data-id"),"khash":nextel.attr("khash"),"title":nexttitle}); $(".navigation-next").show(); } } // 通过JSON格式的数据生成目录树 function generateTree(data) { let result = ""; for(let i=0; i`; if(data[i].ismenu == '1'){ result += `

`; }else{ result += ` `; if(data[i].child && data[i].child.length > 0) { // 如果子元素存在并且数量大于0 result += '
    '; result += generateTree(data[i].child); // 递归调用生成子树 result += '
'; } result += ''; } return result; } // add function get_menus, to get menu info from /getDashMenus function get_menus(){ fetch('https://www.w3cschool.cn/attachments/menu_cache/'+book.pename+'.cache.json') .then(response => { if (!response.ok) { throw new Error('网络请求失败'); } return response.json(); }) .then(data => { // 在这里处理 JSON 数据 let menusTree = generateTree(data); $("#nestable_handbook > ol").html(menusTree); }) .catch(error => { // 处理错误 console.error(error); }); } function isProjectLike(){ if(kn.uid == '' || kn.uid == '0'){ toastr.warning("您还未登录,请先登录!",'',{"positionClass": "toast-top-center"}); return; } $.ajaxdo({ url: "/project/islike/doc_css.html", type: "post", dataType: 'json', data: {}, sync: false, success: function (data) { if (data.statusCode == 200) { $('.avatar-list').find('p').remove(); $('.avatar-list').append(''); var likecount = $("#likecount").text() * 1 + 1; $("#likecount").html(likecount); $(".btn-thumbs-up i").attr('class','icon-thumbs-up isdone'); $("#plikestatus").html('已赞'); toastr.success(data.message,'',{"positionClass": "toast-top-center"}); } else { toastr.warning(data.message,'',{"positionClass": "toast-top-center"}); } } }); } function isProjectStar(){ if(kn.uid == '' || kn.uid == '0'){ toastr.warning("您还未登录,请先登录!",'',{"positionClass": "toast-top-center"}); return; } var type = $('#hbstar').attr('data-type'); $.ajaxdo({ url: "/project/star/doc_css.html", type: "post", dataType: 'json', data: {}, success: function (data) { if(data.statusCode == 200){ if (type == 'star') { $('#hbstar').html(' 已收藏'); $('#hbstar').attr('data-type','rstar'); toastr.success(data.message,'',{"positionClass": "toast-top-center"}); } else { $('#hbstar').html(' 收藏'); $('#hbstar').attr('data-type','star'); toastr.success(data.message,'',{"positionClass": "toast-top-center"}); } }else{ toastr.warning(data.message,'',{"positionClass": "toast-top-center"}); } } }); } function setViewCredit(kename){ /*开启计时 准备记录积分*/ var vcreditfull = $.cookie('ypre_vcreditfull'); var uid = UserInfo.uid; if(vcreditfull == undefined && uid != '0' && uid != ''){ setTimeout(function(){ $.ajaxdo({ url:"/project/setViewCredit", type:"post", data:{kename:kename}, dataType:"json", success:function(msg){ var statusCode = { '200':'success', '400':'warning', }; var toastrType = statusCode[msg.statusCode]; if(msg.statusCode == 300 || msg.statusCode == 400){ return; } if(UserInfo['tipexp'] == 1){ toastr[toastrType](msg.message); } } }); },30000); } } function setKn(ainfo,kename,pename,khash){ // 设置文章状态 $("#km-body").show(); $("#pcover").hide(); //$("body").scrollTop(0); // 页面回到顶部 $(".content-top > h1").text(HTMLDeCode(ainfo.ktitle)); //$(".kn-infomation").html('由 '+ainfo['creator']+' 创建,'+ainfo['lasteditor']+'最后一次修改 '+ainfo['mdate']+' '); $(".view-box").html(ainfo['kcontent']); $(".viewcount-btn > span").text("阅读("+ainfo['viewcount']+")"); // 调整点赞状态 $("#likecount").text(ainfo['likecount']); // var islike = 0; // for(var p in ainfo.likelist){ // if(ainfo.likelist[p].uid == kn.uid){ // islike = 1; // break; // } // } // if(islike){ // $("#likestatus").text("已赞").prev().addClass("isdone");; // }else{ // $("#likestatus").text("赞").prev().removeClass("isdone"); // } // var iscollect = 0; // // 查看是否已经收藏 // $("#kncollect .dd-item").each(function(){ // if($(this).attr("data-id") == kename){ // iscollect = 1; // } // }); // if(iscollect){ // $("#knstar > .icon-star").addClass("isdone"); // $('#knstar').attr('data-type','rstar'); // $("#knstar > span").text("已收藏"); // }else{ // $("#knstar > .icon-star").removeClass("isdone"); // $('#knstar').attr('data-type','star'); // $("#knstar > span").text("收藏"); // } $("#correct").attr("href","/edit/"+pename+"/"+kename); var lang = '',hashStr = ''; if(khash === ''){ // 打开文章滚动到顶部 $("html").scrollTop(0); }else{ hashStr = '#'+khash; } if(book.lang == 'en'){ lang = '?lang='+book.lang; } window.history.pushState({},0,'//'+window.location.host+'/'+pename+'/'+kename+'.html'+lang+hashStr); if(khash !== ''){ // 定位到指定位置 location.href="#"+khash; } kn.kename = kename; kn.ktitle = ainfo['ktitle']; kn.ktype = ainfo['ktype']; kn.original = ainfo['original']; if(typeof prettyPrint != "undefined"){ $(".view-box pre").addClass("prettyprint linenums"); prettyPrint(); }else{ hljs.initHighlightingOnLoad();//高亮代码 } // 上一篇 下一篇 var el = $("#nestable_handbook li.dd-item[data-id='"+kename+"'][khash='"+khash+"']"); //prevnext.call(el[0]); $("#nestable_handbook li.dd-item .dd-content").removeClass("active"); // if(tarli.attr("ismenu") == 0){ // tarli.addClass("readed"); // } el.find(" >.dd-content").addClass("active"); //当文章为文件夹的时候 并且内容为空的时候显示文件夹内部文章列表 if(ainfo['kcontent'] == "" && ainfo['ismenu'] == 1){ $(el).clone().appendTo(".view-box"); $(".view-box").find(".dd-content").removeClass("folder-open").removeClass("folder-close").css({"background-color":"#fff"}); } setViewCredit(kename); // //重新加载赞赏名单 // paypraise.pename = kn.pename; // paypraise.kename = kn.kename; // paypraise.original = kn.original; // updateMember(); } function swiftKn(){ var kename = $(this).attr("data-id"); var khash = $(this).attr("khash"); var pename = kn.pename; var self = this; var getPath = '/getdash'; // 未登录路径 var tarli = $("#nestable_handbook li.dd-item[data-id='"+kename+"']"); // 选中元素 if($(".project-cover").length > 0 && !$(".project-cover").is(":hidden")){ window.location = "/"+pename+"/"+kename+".html"; return; } if(tarli.attr("ktype") == 'klink'){ return; } if(kename === ''){ return; } if(kename == kn.kename && pename == kn.pename){ $("#nestable_handbook .dd-content").removeClass("active"); var el = $("#nestable_handbook li.dd-item[data-id='"+kename+"'][khash='"+khash+"']"); el.find(" >.dd-content").addClass("active"); if(khash !== ''){ location.href="#"+khash; }else{ // body滚动到顶部 $("html").scrollTop(0); var lang = ''; if(book.lang == 'en'){ lang = '?lang='+book.lang; } window.history.pushState({},0,"/"+pename+"/"+kename+".html"+lang); } // 上一篇 下一篇 //prevnext.call(el[0]); return; } if(kn.uid > 0){ // 已登录的情况 getPath = '/my/knowledge/getkn'; } $.ajaxdo({ url:getPath, type:"post", dataType: 'json', data:{ kename:kename, pename:pename, }, beforeSend:function() { $("div.loading-css3").show(); }, complete:function(data) { $("div.loading-css3").hide(); }, success:function(msg) { if(kn.uid > 0){ // 登录后 setKn.apply(this,[msg,kename,pename,khash]); }else{ // 未登录 ainfo = msg.data; if(msg.statusCode < 300){ setKn.apply(this,[ainfo,kename,pename,khash]); }else{ toastr.error(msg.message); } } } }); } $(function(){ $(document).on("click",function(){ $(".docblur").hide(); }); $(".onlinenote").show(); // 加载目录数据 get_menus(); var khash = window.location.hash.replace(/#/,''); var kename = kn.kename; var pename = kn.pename; // 对应的文件夹应该是打开状态 $("#nestable_handbook .dd-item[data-id='"+kn.kename+"']").parents(".dd-item").each(function(){ var obj = $("> .dd-content",this); obj.removeClass("folder-close"); obj.addClass("folder-open"); obj.find(".folder").removeClass("icon-folder-close").addClass("icon-folder-open"); obj.next().show(); }); // 计算文件夹里面有多少索引 $("#nestable_handbook .dd-item[ismenu=1]").each(function(){ var childnum = $('>.dd-list >.dd-item',this).length; $('>.dd-content >.childnum',this).text(childnum); }); $("#nestable_handbook li[data-id='"+kename+"']").each(function(){ if($(this).attr("khash") == khash){ $("#nestable_handbook .dd-content").removeClass("active"); $(">.dd-content",this).addClass("active"); var el = $("#nestable_handbook li.dd-item[data-id='"+kename+"'][khash='"+khash+"']"); console.log(el); //prevnext.call(el[0]); } }); /** * 搜索项目 * @return {[type]} [description] */ function searchli(){ var resStr=''; var keyword = $("._search-input").val(); if(keyword === ''){ $("#indexsRemove").hide(); $(".sidebar-tree-content").removeClass("hide1"); $(".search-box").addClass("hide1"); }else{ $("#indexsRemove").show(); $(".sidebar-tree-content").addClass("hide1"); $(".search-box").removeClass("hide1"); keyword = keyword.toLowerCase(); $("#nestable_handbook .dd-content a").each(function(){ var title = $(this).text(); tmptitle = title.toLowerCase(); var kename='',ismenu='0',khash='',dditem=null,active=''; if(tmptitle.indexOf(keyword) == -1){ }else{ dditem = $(this).parent().parent(); kename = dditem.attr("data-id"); khash = dditem.attr("khash"); if(kename == kn.kename && khash == window.location.hash){ active = 'active'; } resStr += '
  • "; } }); $(".searchres").html(resStr); } } $("._search-input").on("keyup",function(e){ searchli.call(this); }); // 点击搜索按钮 $("#indexsSearch").on("click",function(){ searchli.call(this); }); $("#indexsRemove").on("click",function(){ $("._search-input").val(""); $(this).hide(); $(".sidebar-tree-content").removeClass("hide1"); $(".search-box").addClass("hide1"); }); $(document).on('keyup',function(e){ var keyCode = e.keyCode; var prev,next; if(keyCode == 37){ // 上一篇 prev = $(".navigation-prev"); if(prev.length > 0 && !prev.is(":hidden")){ prev.trigger("click"); } } if(keyCode == 39){ // 下一篇 next = $(".navigation-next"); if(next.length > 0 && !next.is(":hidden")){ next.trigger("click"); } } }); if(location.hash !== ""){ // 修复锚点定位失效的问题 setTimeout(function(){ location.href=location.hash; },300); } $(".previous-link,.next-link").on("click",function(e){ e.stopPropagation(); var obj = $(this).find(">a"); swiftKn.call(obj[0]); }); $(".navigation-box > a").on("click",function(e){ e.stopPropagation(); swiftKn.call(this); }); /** * 切换文章 */ $("#nestable_handbook").on("click", "li.dd-item[ismenu=0] > .dd-content a", function(e){ e.stopPropagation(); var tarli = $(this).parent().parent(); swiftKn.call(tarli[0]); }); $("#knsearch").on("click","li.dd-item > .dd-content a",function(e){ e.stopPropagation(); $("#knsearch .dd-content").removeClass("active"); $(this).parent().addClass("active"); var tarli = $(this).parent().parent(); swiftKn.call(tarli[0]); }); $(".view-box").on("click","li.dd-item",function(e){ e.stopPropagation(); swiftKn.call(this); }); // 收藏夹 $("#kncollect").on("click",".dd-item",function(e){ e.stopPropagation(); swiftKn.call(this); }); var kename = kn.kename; var fid = "1000016381"; var uid = '0'; setViewCredit(kename); var edtype = ''; if(edtype == 'md'){ $("pre").addClass("prettyprint linenums"); prettyPrint(); }else{ hljs.initHighlightingOnLoad();//高亮代码 } window._bd_share_config={"common":{"bdSnsKey":{},bdPopupOffsetTop:"5"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='https://www.w3cschool.cn/plugins/baidushare/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)]; }); $(".toggle-dropdown").on('click',function(e){ e.stopPropagation(); if ($(this).next().is(":hidden")){ $(this).next().show(); }else{ $(this).next().hide(); } }); $(".set-dropdown-menu").on("click",function(e){ e.stopPropagation(); }); // function getviewkn(){ // var usernamestr =''; // $.ajax({ // url:"/my/knowledge/getViewkn?pename="+book.pename, // dataType:"json", // success:function(msg){ // var objli,objtt; // for(var p in msg){ // objli = $("#nestable_handbook").find(".dd-item[data-id='"+msg[p]['kename']+"']"); // if(objli.attr("ismenu") != 1){ // objli.addClass("readed").find("a").attr("title","上次浏览时间:("+msg[p]['lasttime']+")"); // } // } // } // }); // } !function () { var timer = null; var toolbar = $('#toolbar'); toolbar.css({ right: '-60px', transition: 'right 0.24s', webkitTransition: 'right 0.24s' }); $(window).on('scroll', function () { showToolbar(); clearTimeout(timer); timer = setTimeout(function() { hideToolbar(); }, 1000) }); toolbar.hover(function(){ showToolbar(); clearTimeout(timer); }, function () { timer = setTimeout(function() { hideToolbar(); }, 1000) }); function showToolbar () { toolbar.css('right', '0'); } function hideToolbar () { toolbar.css('right', '-60px'); } }()