自定义菜单脚本协助需要

时间:2013-02-02 16:21:28

标签: magento-1.7

我正在使用Magento的自定义菜单扩展程序。我有一个问题。菜单上会出现一个弹出下拉框。当我使用firebug跟踪编码时,我发现:

<div id="popup6" class="wp-custom-menu-popup" onmouseover="wpPopupOver(this, event, 'popup6', 'menu6')" onmouseout="wpHideMenuPopup(this, event, 'popup6', 'menu6')" style="display: none; top: 20px; left: 20px; z-index: 10000;">

我无法在扩展名的文件中找到此代码,因此我追踪了这个:

<script type="text/javascript">
//<![CDATA[
var CUSTOMMENU_POPUP_WIDTH = <?php echo Mage::getStoreConfig('custom_menu/popup/width') + 0; ?>;
var CUSTOMMENU_POPUP_TOP_OFFSET = <?php echo Mage::getStoreConfig('custom_menu/popup/top_offset') + 0; ?>;
var CUSTOMMENU_POPUP_DELAY_BEFORE_DISPLAYING = <?php echo Mage::getStoreConfig('custom_menu/popup/delay_displaying') + 0; ?>;
var CUSTOMMENU_POPUP_DELAY_BEFORE_HIDING = <?php echo Mage::getStoreConfig('custom_menu/popup/delay_hiding') + 0; ?>;
var CUSTOMMENU_RTL_MODE = <?php echo $_rtl; ?>;
var wpCustommenuTimerShow = {};
var wpCustommenuTimerHide = {};
//]]>

我需要更改顶部:20px我应该在哪里找到它?它不在js文件中而不在css文件中...无法在任何地方找到它。有任何想法吗?我是个初学者!根据我的理解,它必须是JS文件,我不知道如何阅读它。 JS在这里:

function wpShowMenuPopup(objMenu, popupId)
{
if (typeof wpCustommenuTimerHide[popupId] != 'undefined') clearTimeout(wpCustommenuTimerHide[popupId]);
objMenu = $(objMenu.id); var popup = $(popupId); if (!popup) return;
wpCustommenuTimerShow[popupId] = setTimeout(function() {
    popup.style.display = 'block';
    objMenu.addClassName('active');
    var popupWidth = CUSTOMMENU_POPUP_WIDTH;
    if (!popupWidth) popupWidth = popup.getWidth();
    var pos = wpPopupPos(objMenu, popupWidth);
    popup.style.top = pos.top + 'px';
    popup.style.left = pos.left + 'px';
    wpSetPopupZIndex(popup);
    if (CUSTOMMENU_POPUP_WIDTH)
        popup.style.width = CUSTOMMENU_POPUP_WIDTH + 'px';
    // --- Static Block width ---
    var block2 = $(popupId).select('div.block2');
    if (typeof block2[0] != 'undefined') {
        var wStart = block2[0].id.indexOf('_w');
        if (wStart > -1) {
            var w = block2[0].id.substr(wStart+2);
        } else {
            var w = 0;
            $(popupId).select('div.block1 div.column').each(function(item) {
                w += $(item).getWidth();
            });
        }
        //console.log(w);
        if (w) block2[0].style.width = w + 'px';
    }
}, CUSTOMMENU_POPUP_DELAY_BEFORE_DISPLAYING);
}

function wpHideMenuPopup(element, event, popupId, menuId)
{
if (typeof wpCustommenuTimerShow[popupId] != 'undefined') clearTimeout(wpCustommenuTimerShow[popupId]);
element = $(element.id); var popup = $(popupId); if (!popup) return;
var current_mouse_target = null;
if (event.toElement) {
    current_mouse_target = event.toElement;
} else if (event.relatedTarget) {
    current_mouse_target = event.relatedTarget;
}
wpCustommenuTimerHide[popupId] = setTimeout(function() {
    if (!wpIsChildOf(element, current_mouse_target) && element != current_mouse_target) {
        if (!wpIsChildOf(popup, current_mouse_target) && popup != current_mouse_target) {
            popup.style.display = 'none';
            $(menuId).removeClassName('active');
        }
    }
}, CUSTOMMENU_POPUP_DELAY_BEFORE_HIDING);
}

function wpPopupOver(element, event, popupId, menuId)
{
if (typeof wpCustommenuTimerHide[popupId] != 'undefined') clearTimeout(wpCustommenuTimerHide[popupId]);
}

function wpPopupPos(objMenu, w)
{
var pos = objMenu.cumulativeOffset();
var wraper = $('custommenu');
var posWraper = wraper.cumulativeOffset();
var xTop = pos.top - posWraper.top
if (CUSTOMMENU_POPUP_TOP_OFFSET) {
    xTop += CUSTOMMENU_POPUP_TOP_OFFSET;
} else {
    xTop += objMenu.getHeight();
}
var res = {'top': xTop};
if (CUSTOMMENU_RTL_MODE) {
    var xLeft = pos.left - posWraper.left - w + objMenu.getWidth();
    if (xLeft < 0) xLeft = 0;
    res.left = xLeft;
} else {
    var wWraper = wraper.getWidth();
    var xLeft = pos.left - posWraper.left;
    if ((xLeft + w) > wWraper) xLeft = wWraper - w;
    if (xLeft < 0) xLeft = 0;
    res.left = xLeft;
}
return res;
}

function wpIsChildOf(parent, child)
{
if (child != null) {
    while (child.parentNode) {
        if ((child = child.parentNode) == parent) {
            return true;
        }
    }
}
return false;
}

function wpSetPopupZIndex(popup)
{
$$('.wp-custom-menu-popup').each(function(item){
   item.style.zIndex = '9999';
});
popup.style.zIndex = '10000';
}

enter code here

1 个答案:

答案 0 :(得分:0)

自定义菜单设置中有一个选项 - 顶部偏移,此选项可能定义 top:20px; 属性。