将网站移植到Joomla:我如何处理Javascript菜单?

时间:2021-08-05 03:31:30

I am porting an existing site to Joomla 1.5. The menus on the existing site use rollover images and inline Javascript. How can I make the menus look the same in Joomla and use the Joomla menus, without rewriting the menu code?

我将现有网站移植到Joomla 1.5。现有站点上的菜单使用翻转图像和内联Javascript。如何在Joomla中使菜单看起来相同并使用Joomla菜单,而无需重写菜单代码?

2 个解决方案

#1


It ended up being rather simple, actually. Joomla renders menus as <UL><LI><A> tags. All I had to do was extract the background from one of the menu images (both in selected and unselected state), set a images as the background in each of the styles in the Joomla CSS, and voila, it almost looks exactly like the old site (minus a slightly different font, since the text is no longer part of the image).

实际上它最终变得相当简单。 Joomla将菜单呈现为

#2


To show a menu item as an image, edit your menu item and select an image under the Parameters (System) heading (This list automatically populates with the images in the images/stories folder).

要将菜单项显示为图像,请编辑菜单项并在“参数(系统)”标题下选择一个图像(此列表会自动填充images / stories文件夹中的图像)。

You will also need to set the module for the menu to display the images you set. Go to Extensions > Modules, then select the module for your menu (for instance, Main Menu). From there, select Other Parameters and then set Show Menu Images and Menu Image Link to Yes.

您还需要设置菜单模块以显示您设置的图像。转到扩展>模块,然后选择菜单模块(例如,主菜单)。从那里,选择其他参数,然后将显示菜单图像和菜单图像链接设置为是。

The rollovers will be a bit trickier. You won't be able to add inline JavaScript, but you might be able to use JavaScript to find your menu and assign rollovers to each item. Joomla ships with MooTools, or you can use jQuery if you're more comfortable wit hit. Use the Menu Tag ID field under Advanced Parameters to give your menu ul element an HTML id.

翻车会有点棘手。您将无法添加内联JavaScript,但您可以使用JavaScript查找菜单并为每个项目分配翻转。 Joomla附带MooTools,或者你可以使用jQuery,如果你更舒服机智。使用“高级参数”下的“菜单标签ID”字段为菜单ul元素指定HTML ID。

#1


It ended up being rather simple, actually. Joomla renders menus as <UL><LI><A> tags. All I had to do was extract the background from one of the menu images (both in selected and unselected state), set a images as the background in each of the styles in the Joomla CSS, and voila, it almost looks exactly like the old site (minus a slightly different font, since the text is no longer part of the image).

实际上它最终变得相当简单。 Joomla将菜单呈现为

#2


To show a menu item as an image, edit your menu item and select an image under the Parameters (System) heading (This list automatically populates with the images in the images/stories folder).

要将菜单项显示为图像,请编辑菜单项并在“参数(系统)”标题下选择一个图像(此列表会自动填充images / stories文件夹中的图像)。

You will also need to set the module for the menu to display the images you set. Go to Extensions > Modules, then select the module for your menu (for instance, Main Menu). From there, select Other Parameters and then set Show Menu Images and Menu Image Link to Yes.

您还需要设置菜单模块以显示您设置的图像。转到扩展>模块,然后选择菜单模块(例如,主菜单)。从那里,选择其他参数,然后将显示菜单图像和菜单图像链接设置为是。

The rollovers will be a bit trickier. You won't be able to add inline JavaScript, but you might be able to use JavaScript to find your menu and assign rollovers to each item. Joomla ships with MooTools, or you can use jQuery if you're more comfortable wit hit. Use the Menu Tag ID field under Advanced Parameters to give your menu ul element an HTML id.

翻车会有点棘手。您将无法添加内联JavaScript,但您可以使用JavaScript查找菜单并为每个项目分配翻转。 Joomla附带MooTools,或者你可以使用jQuery,如果你更舒服机智。使用“高级参数”下的“菜单标签ID”字段为菜单ul元素指定HTML ID。