0

Magentoにナビゲーションメニューがあり、マウスオーバーするとサブカテゴリが表示されます。jQueryプラグインを使用するカウントダウンもあります。

カウントダウンを削除するとメニューは正常に機能しますが、カウントダウンを追加するとカウントダウンは正常に機能しますが、マウスオーバー時にメニューにカテゴリが表示されなくなります。

メニュー項目のコード:

<div id="menu10" class="menu popup-menu level-2" onmouseover="wpShowMenuPopup(this, 'popup10');" onmouseout="wpHideMenuPopup(this, event, 'popup10', 'menu10')">
<div class="parentMenu">
<a href="supertrash.html">
<span>SuperTrash</span>
</a>
</div>
</div>
<div id="popup10" class="popup child-2" onmouseout="wpHideMenuPopup(this, event, 'popup10', 'menu10')">
<div class="block1">
<div class="column"><div class="itemMenu level1"><a class="itemMenuName level1" href="supertrash/supertrash-rokjes.html">Rokjes</a></div></div><div class="column"><div class="itemMenu level1"><a class="itemMenuName level1" href="supertrash/stschoenen.html">Schoenen</a></div></div>
<div class="clearBoth"></div>
</div>
</div>      

マウスオーバーのJavaScript:

function wpShowMenuPopup(objMenu, popupId)
{
    objMenu = $(objMenu.id); var popup = $(popupId); if (!popup) return;
    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';
    if (CUSTOMMENU_POPUP_WIDTH) popup.style.width = CUSTOMMENU_POPUP_WIDTH + 'px';
}

カウントダウンに使用されるjQueryプラグイン:

<!-- jquery framework from google api -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>

<!-- google font-family, you can add whatever font suits you -->
<link href='http://fonts.googleapis.com/css?family=Averia+Serif+Libre:300italic' rel='stylesheet' type='text/css'>

<!-- The stylesheet -->
<link rel="stylesheet" type="text/css" href="counter2/css/style2.css">

<!-- the countdown plugin -->
<script src="counter2/coffeetime/coffeetime.min.js"></script>
<!-- The countdown style -->
<link rel="stylesheet" type="text/css" href="counter2/coffeetime/ctstyle.css">
<script>

/* here u can set up different messages for the progress of the countdown
if no message is set for the current percent value, it takes the next message, bigger or equal to that percentage
*/
var message = new Array();
message[0] = "status: just started";
message[10] = "status: drinking a coffe";
message[20] = "status: just finished setting up the database";
message[30] = "status: brainstorming about the template";
message[50] = "status: choosing the color scheme";
message[80] = "status: thinking about the future";
message[90] = "status: nearly done";
message[100] = "status: finished";

$(document).ready(function() {

function callback() {
    alert("Sale is over");
}


$("#flipit").coffeetime({
                        /* COUNTDOWN SETTINGS */
                        message: message, // the message array with the array keys as percent values
                        startYear: 2012,
                        startMonth: 8,
                        startDay: 30,
                        endYear: 2012,
                        endMonth: 9,
                        endDay: 7,

                        callbackFinish : callback,
                            });

$(".flip-title-subheading").html(" we started on "+ window.startDate+ " and we`ll finish on "+ window.endDate);

});

$(document).ready(function () {
    setTimeout(function () {
        $(".flip-container").animate({
            "height" : 105 + "px"
        }, 1000, "swing");
    }, 1000);
});

</script>

私はいくつかのことを試しました:

  • ヘッダーには、(古い(1.4.3))バージョンのjQueryも含まれており、1.8.0バージョンに置き換えようとしましたが、何も機能しませんでした

  • カウントダウンに含まれている1.8.0バージョンを削除しようとしましたが、メニューは正しく機能しますが、カウントダウンはありません

  • カウントダウンにjQuery.noConflict()を使用してみましたが、メニューは機能し続けますが、カウントダウンは機能しません

私は途方に暮れています、誰かが私が間違っていることを知っていることを願っています、ありがとう!

4

3 に答える 3

0

noConflict()を試すように指示しますが、すでに試しています。したがって、jQueryの$を変更してみてください。この保証マゼントは、適切なJSを使用し、cuzプロトタイプも$を使用します。うまくいかない場合は、ページで同じことを行う2つのJSスクリプトを探してください。そして、1つを削除します。

于 2012-09-05T14:11:20.217 に答える
0

マウスオーバー機能を次のように追加します

jQuery.noConflict();

function wpShowMenuPopup(objMenu, popupId)

{{

objMenu = jQuery(objMenu.id); var popup = jQuery(popupId); if (!popup) return;
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';
if (CUSTOMMENU_POPUP_WIDTH) popup.style.width = CUSTOMMENU_POPUP_WIDTH + 'px';

}

お役に立てれば!!

于 2012-09-05T18:20:52.777 に答える
0

結局、それはnoConflict()でした。

カウントダウンスクリプトの直前に以下を追加します

var $c = jQuery.noConflict(); 

そして$、カウントダウンのすべての変数を機能するように変更します$c

私はnoConflict(以前に宣言された)の変数$iと変数を使用していましたが、新しい変数を作成すると魔法のように機能しました。$j皆さんありがとう!

于 2012-09-05T21:05:48.203 に答える