gpt4 book ai didi

javascript - Wordpress:使菜单链接的行为与 "more"按钮相同

转载 作者:行者123 更新时间:2023-11-28 08:23:23 25 4
gpt4 key购买 nike

我对我网站上的 wordpress 菜单有疑问。如果您以移动分辨率打开我的网站(只需缩小它),您可以看到菜单更改为移动版本,这很好。

我希望 Sneakers + 和 Shop reviews + 链接的行为与其旁边的箭头按钮相同,因此,当移动用户单击 Sneakers + 时,相应的菜单将折叠,就像您点击箭头按钮时一样。

我尝试检查代码,但箭头按钮仅包含以下内容:

<i class="next-level"></i>

网站是 www.nieuwesneakers.nl

在菜单项上使用的正确代码或 href=""是什么?href 现在是“#”,因为它的唯一用途是指示下一级菜单。

提前致谢。

最佳答案

I've looked at your website and am not entirely sure what exactly you are asking. I observe the behaviour on the mobile site (the available arrows and the corresponding behaviour). Where do you want this behaviour to be available to you? Also, are you familiar with Mozilla's Inspector Tool and Chrome Development Tools? If you hit CNTRL + SHIFT + i in Chrome while on your site, you can do a number of really cool things. The problem with Wordpress, though, is that a lot of the plugins are proprietary and the developers appear to have purposefully mal-structured their code.

上面只是引用我自己的话,所以我可以在答案中对其进行扩展;但是,正如您将看到的,这并不是您问题的真正答案。

Wordpress 就是所谓的内容管理系统(CMS;或 CMA - 助理的“A”)。它旨在让那些没有发布网站所需的编码背景的人可以使用网络具有相同的质量,并且是 Internet 的 Web 2.0 哲学的一部分 - 让全世界都可以访问 Internet。它是一个神奇而强大的工具,它使许多开发人员以更少的工作量赚了很多钱;但是,它经常意味着当人们遇到 CMA 时,他们不确定他们到底在做什么(这种情况并不意味着您是该组的一部分)。

作为动态的一部分,有很多很酷的东西可用,比如菜单 slider 和基于 JQuery 的 UI 等。所有这些都会变得相当复杂,因为网站上充斥着一堆“很酷的东西” .问题是——虽然我们可以访问这些 UI 插件的代码——这些插件的代码是由知道他们在做什么的人编写的(无论是好的还是坏的)。 “好的是他们想为您的网站提供最好的(并且被称为提供周围“最酷的东西”);但是,正如网络开发工具将向您展示的那样,所有(或很多)代码都是提供给你。

动机

那么,插件开发者是如何应对的呢?他们的代码格式错误。直接从您的网站中提取的示例:

请勿编辑以下代码(我知道它的格式很糟糕,这就是重点!)

function simple_tooltip(t,e){jQuery(t).each(function(t){jQuery("body").append("<div class='"+e+"' id='"+e+t+"'>"+jQuery(this).find("span.tooltip-c").html()+"</div>");var i=jQuery("#"+e+t);jQuery(this).removeAttr("title").mouseover(function(){i.css({opacity:1,display:"none"}).fadeIn(400)}).mousemove(function(t){var e,n,o=jQuery(window).scrollTop(),a=jQuery(window).width(),s=15;e=a-2*s>=i.width()+t.pageX?t.pageX+s:a-i.width()-s,n=o+2*s>=t.pageY-i.height()?o+s:t.pageY-i.height()-2.2*s,i.css({left:e,top:n})}).mouseout(function(){i.css({left:"-9999px"})})})}jQuery(document).ready(function(t){if(dtGlobals.isWindowsPhone&&t("body").addClass("ie-mobile"),!t("html").hasClass("old-ie")){dtGlobals.isPhone=!1,dtGlobals.isTablet=!1,dtGlobals.isDesktop=!1;var e=window.getComputedStyle(document.body,":after").getPropertyValue("content");-1!=e.indexOf("phone")&&dtGlobals.isMobile?dtGlobals.isPhone=!0:-1!=e.indexOf("tablet")&&dtGlobals.isMobile?dtGlobals.isTablet=!0:dtGlobals.isDesktop=!0}window.retinizer=function(){if(t("body").hasClass("srcset-enabled")){var e=t("img:not(.retinized)").filter("[srcset]"),i=window.devicePixelRatio?window.devicePixelRatio:1;if(e.each(function(){var e=t(this),n=e.attr("srcset").split(","),o=[],a="";n.forEach(function(e){var i=t.trim(e).split(" ");o[i[1]]=i[0]}),a=i>=1.5?"undefined"!=typeof o["2x"]?o["2x"]:o["1x"]:"undefined"!=typeof o["1x"]?o["1x"]:o["2x"],e.attr("src",a).addClass("retinized")}),"undefined"!=typeof dtGlobals.logoURL){var n=dtGlobals.logoURL.split(","),o=[];n.forEach(function(e){var i=t.trim(e).split(" ");o[i[1]]=i[0]}),dtGlobals.logoURL=i>=1.5?"undefined"!=typeof o["2x"]?o["2x"]:o["1x"]:"undefined"!=typeof o["1x"]?o["1x"]:o["2x"]}}},retinizer();var i;if(dtGlobals.isMobile&&!dtGlobals.isWindowsPhone?t(window).bind("orientationchange",function(){clearTimeout(i),i=setTimeout(function(){t(window).trigger("debouncedresize")},200)}):t(window).on("resize",function(){clearTimeout(i),i=setTimeout(function(){t(window).trigger("debouncedresize")},200)}),!t("html").hasClass("old-ie")){var n=['<g id="social-500px"><path d="M11.969 13.544c1.137 1.3 2.5 2.5 4.3 2.467c2.364 0 3.775-1.795 3.775-4.08 c0-2.279-1.438-3.973-3.756-3.973c-1.848 0-3.059 1.202-4.232 2.621c-1.201-1.44-2.393-2.621-4.279-2.621 C5.477 8 4 9.7 4 12.005c0 2.3 1.6 4 3.8 4.037c1.93-0.08 2.977-1.325 4.117-2.498H11.969z M5.715 12 c0-1.011 0.656-2.114 1.865-2.114c1.233 0 2.5 1.3 3.4 2.137c-0.82 0.957-2.015 1.99-3.265 2 c-1.285-0.021-1.974-0.842-1.974-2.013H5.715z M13.146 12.099c0.867-0.94 1.941-2.123 3.219-2.123c1.246 0 2 0.9 2 2.1 c0 1.104-0.645 2.025-1.876 1.973c-1.333 0.049-2.469-0.879-3.282-1.898L13.146 12.099z"/></g>','<g id="vk"><path d="M12.235 16.191c0.372 0 0.524-0.248 0.516-0.56c-0.017-1.17 0.438-1.797 1.258-0.978 c0.908 0.9 1.1 1.5 2.1 1.502c0.418 0 1.5 0 1.9 0c1.528 0 0.166-1.54-0.916-2.54c-1.024-0.952-1.071-0.979-0.189-2.123 c1.102-1.425 2.535-3.26 1.266-3.26c-0.246 0-0.072 0-2.428 0c-0.471 0-0.501 0.277-0.672 0.7 c-0.604 1.429-1.758 3.28-2.195 3.001c-0.46-0.295-0.248-1.3-0.213-3.038c0.014-0.459 0.01-0.774-0.694-0.94 c-1.92-0.447-3.578 0.431-2.9 0.537c0.954 0.2 0.9 2 0.6 2.98c-0.387 1.558-1.851-1.235-2.457-2.623 C7.25 8.5 7.2 8.3 6.7 8.277c-0.29 0-1.558 0-1.986 0c-0.382 0-0.569 0.177-0.434 0.531c0.133 0.3 1.7 3.8 3.4 5.8 c1.718 1.7 3.4 1.6 4.6 1.597H12.235L12.235 16.191z"/></g>','<g id="tripedvisor"><path fill="none" d="M15.825 9.215c-1.584 0-2.873 1.291-2.873 2.874c0 1.6 1.3 2.9 2.9 2.876s2.873-1.292 2.873-2.876 C18.698 10.5 17.4 9.2 15.8 9.215z M15.879 13.729c-0.423 0-0.82-0.164-1.118-0.464c-0.299-0.301-0.465-0.697-0.465-1.121 c0-0.421 0.166-0.818 0.465-1.119c0.298-0.298 0.695-0.461 1.118-0.461c0.873 0 1.6 0.7 1.6 1.6 C17.464 13 16.8 13.7 15.9 13.729z"/><path 

它几乎不可读,这是故意的。这是代码的部分,全部一行。它使您看到的复制行为难以隔离,更重要的是,除非您真的知道自己在做什么,否则难以复制。

脚本的非恶意更改

通常情况下,JavaScript(在这种情况下)会经历这个过程 - 称为“缩小” - 以确保代码尽可能减少开销。缩小通常会删除空格、重命名变量等以“丑化代码”——使其在加载时间方面尽可能高效。

关于javascript - Wordpress:使菜单链接的行为与 "more"按钮相同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28645997/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com