索引页面的活动导航菜单项

时间:2018-12-18 10:02:03

标签: jquery css

当用户位于该页面上时,我可以拾取任何页面的URL并在菜单项上设置“活动”状态,以更改主菜单导航链接的样式。但是,当用户在主页上时,他们都被设置了,所以我想知道如何对此进行警告,而不在所有链接上以及仅在use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\RichText; use PhpOffice\PhpSpreadsheet\RichText\Run; use PhpOffice\PhpSpreadsheet\Style\Font; class RichTextService { /** * Takes array where of CSS properties / values and converts to CSS stri$ * * @param array * @return string */ private function assembleCSS($pValue = array()) { $pairs = array(); foreach ($pValue as $property => $value) { $pairs[] = $property . ':' . $value; } $string = implode('; ', $pairs); return $string; } /** * Create CSS style (Font) * * @param Font $pStyle Font * @return array */ private function createCSSStyleFont(Font $pStyle) { // Construct CSS $css = array(); // Create CSS if ($pStyle->getBold()) { $css['font-weight'] = 'bold'; } if ($pStyle->getUnderline() != Font::UNDERLINE_NONE && $pStyle->getStrikethrough()) { $css['text-decoration'] = 'underline line-through'; } elseif ($pStyle->getUnderline() != Font::UNDERLINE_NONE) { $css['text-decoration'] = 'underline'; } elseif ($pStyle->getStrikethrough()) { $css['text-decoration'] = 'line-through'; } if ($pStyle->getItalic()) { $css['font-style'] = 'italic'; } $css['color'] = '#' . $pStyle->getColor()->getRGB(); $css['font-family'] = '\'' . $pStyle->getName() . '\''; $css['font-size'] = $pStyle->getSize() . 'pt'; return $css; } /** * * @param RichText|string $value * @return string */ public function getHTML($value) { if(is_string($value)) { return $value; } $cellData = ''; if ($value instanceof PhpOffice\PhpSpreadsheet\RichText\RichText) { // Loop through rich text elements $elements = $value->getRichTextElements(); foreach ($elements as $element) { // Rich text start? print_r($element); if ($element instanceof PhpOffice\PhpSpreadsheet\RichText\Run) { $cellData .= '<span style="' . $this->assembleCSS($this->createCSSStyleFont($element->getFont())) . '">'; if ($element->getFont()->getSuperScript()) { $cellData .= '<sup>'; } elseif ($element->getFont()->getSubScript()) { $cellData .= '<sub>'; } } // Convert UTF8 data to PCDATA $cellText = $element->getText(); $cellData .= htmlspecialchars($cellText); if ($element instanceof PhpOffice\PhpSpreadsheet\RichText\Run) { if ($element->getFont()->getSuperScript()) { $cellData .= '</sup>'; } elseif ($element->getFont()->getSubScript()) { $cellData .= '</sub>'; } $cellData .= '</span>'; } } } return str_replace("\n", "<br>\n", $cellData); } } (根)上显示活动状态

/

这也许曾经如此简单,但JQuery并不是我最强的语言。