0

カーソルが左にホバリングしているときに左から来るナビゲーションが必要な Web サイトに取り組んでいます。

必要なものに非常に近いリンクを 1 つ見つけましたが、自分で試すたびにうまくいきません! 私が知っていることはすべて試し、ページのすべての行をコピーしたかどうかをよく調べました。

これはリンクです: http://jsfiddle.net/PktxV/

そして、これはコードです:

HTML

<div id="sidePanel">
<div id="panelContent">
    <iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2FWebsTutorial&amp;width=200&amp;height=258&amp;colorscheme=light&amp;show_faces=true&amp;border_color&amp;stream=false&amp;header=false&amp;appId=253401284678598"
    scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:200px; height:258px;"
    allowTransparency="true"></iframe>
</div>
<div id="panelHandle">
    <p>Facebook</p>
</div>

CSS

    /* ===== Primary Styles ========================================================
   Author: NTechi | WebsTutorial
   ========================================================================== */
 body {
    font-family:Arial;
}
#sidePanel {
    width:245px;
    position:fixed;
    left:-202px;
    top:15%;
}
#panelHandle {
    background-image: -webkit-linear-gradient(top, #333, #222);
    background-image: -moz-linear-gradient(center top, #333333, #222222);
    background-image: -o-linear-gradient(center top, #333333, #222222);
    background-image: -ms-linear-gradient(center top, #333333, #222222);
    background-image:linear-gradient(center top, #333333, #222222);
    height:150px;
    width:40px;
    border-radius:0 5px 5px 0;
    float:left;
    cursor:pointer;
}
#panelContent {
    float:left;
    border:1px solid #333333;
    width:200px;
    height:300px;
    background-color:#EEEEEE;
}
#panelHandle p {
    -moz-transform: rotate(90deg);
    -webkit-transform: rotate(90deg);
    color: #FFFFFF;
    font-size: 24px;
    font-weight: bold;
    left: -4px;
    margin: 0;
    padding: 0;
    position: relative;
    top: 26px;
}

jQuery

    jQuery(function ($) {
    $(document).ready(function () {
        $('#panelHandle').hover(function () {
            $('#sidePanel').stop(true, false).animate({
                'left': '0px'
            }, 900);
        }, function () {
            jQuery.noConflict();
        });

        jQuery('#sidePanel').hover(function () {
            // Do nothing
        }, function () {

            jQuery.noConflict();
            jQuery('#sidePanel').animate({
                left: '-201px'
            }, 800);

        });
    });
});

これが古いバージョンなのか何かなのか、それとも HTML5 ページ (私が作成しようとしているもの) に問題があるのか​​ 、おそらく新しい/より良いスライダーのリンクを取得できるかを知っている人はいますか?

編集!!

これは私がHTML5ドキュメントでそれを持っている方法です

    <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
/* ===== Primary Styles ========================================================
   Author: NTechi | WebsTutorial
   ========================================================================== */
 body {
    font-family:Arial;
}
#sidePanel {
    width:245px;
    position:fixed;
    left:-202px;
    top:15%;
}
#panelHandle {
    background-image: -webkit-linear-gradient(top, #333, #222);
    background-image: -moz-linear-gradient(center top, #333333, #222222);
    background-image: -o-linear-gradient(center top, #333333, #222222);
    background-image: -ms-linear-gradient(center top, #333333, #222222);
    background-image:linear-gradient(center top, #333333, #222222);
    height:150px;
    width:40px;
    border-radius:0 5px 5px 0;
    float:left;
    cursor:pointer;
}
#panelContent {
    float:left;
    border:1px solid #333333;
    width:200px;
    height:300px;
    background-color:#EEEEEE;
}
#panelHandle p {
    -moz-transform: rotate(90deg);
    -webkit-transform: rotate(90deg);
    color: #FFFFFF;
    font-size: 24px;
    font-weight: bold;
    left: -4px;
    margin: 0;
    padding: 0;
    position: relative;
    top: 26px;
}
</style>

</head>

<body>
<script src="text/javascript">
$(document).ready(function () {
    $('#sidePanel').hover(function () {
        $(this).stop(true, false).animate({
            'left': '0px'
        }, 900);
    }, function () {
        $(this).stop(true, false).animate({
            'left': '-202px'
        }, 900);
    });
});
</script>
<div id="sidePanel">
    <div id="panelContent">
        <iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2FWebsTutorial&amp;width=200&amp;height=258&amp;colorscheme=light&amp;show_faces=true&amp;border_color&amp;stream=false&amp;header=false&amp;appId=253401284678598"
        scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:200px; height:258px;"
        allowTransparency="true"></iframe>
    </div>
    <div id="panelHandle">
        <p>Facebook</p>
    </div>
</div>
</body>
</html>
4

2 に答える 2

1

これを試してDEMOを見てください:

$(document).ready(function () {
    $('#sidePanel').hover(function () {
        $(this).stop(true, false).animate({
            'left': '0px'
        }, 900);
    }, function () {
        $(this).stop(true, false).animate({
            'left': '-202px'
        }, 900);
    });
});

編集:

HTML を含むすべてのページを次のように変更します。

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
/* ===== Primary Styles ========================================================
   Author: NTechi | WebsTutorial
   ========================================================================== */
 body {
    font-family:Arial;
}
#sidePanel {
    width:245px;
    position:fixed;
    left:-202px;
    top:15%;
}
#panelHandle {
    background-image: -webkit-linear-gradient(top, #333, #222);
    background-image: -moz-linear-gradient(center top, #333333, #222222);
    background-image: -o-linear-gradient(center top, #333333, #222222);
    background-image: -ms-linear-gradient(center top, #333333, #222222);
    background-image:linear-gradient(center top, #333333, #222222);
    height:150px;
    width:40px;
    border-radius:0 5px 5px 0;
    float:left;
    cursor:pointer;
}
#panelContent {
    float:left;
    border:1px solid #333333;
    width:200px;
    height:300px;
    background-color:#EEEEEE;
}
#panelHandle p {
    -moz-transform: rotate(90deg);
    -webkit-transform: rotate(90deg);
    color: #FFFFFF;
    font-size: 24px;
    font-weight: bold;
    left: -4px;
    margin: 0;
    padding: 0;
    position: relative;
    top: 26px;
}
</style>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<script>

$(document).ready(function () {
    $('#sidePanel').hover(function () {
        $(this).stop(true, false).animate({
            'left': '0px'
        }, 900);
    }, function () {
        $(this).stop(true, false).animate({
            'left': '-202px'
        }, 900);
    });
});

</script>

</head>


<body>
<div id="sidePanel">
    <div id="panelContent">
        <iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2FWebsTutorial&amp;width=200&amp;height=258&amp;colorscheme=light&amp;show_faces=true&amp;border_color&amp;stream=false&amp;header=false&amp;appId=253401284678598"
        scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:200px; height:258px;"
        allowTransparency="true"></iframe>
    </div>
    <div id="panelHandle">
        <p>Facebook</p>
    </div>
</div>
</body>
</html>
于 2013-02-22T16:06:50.827 に答える
0

jQuery ライブラリが含まれていないため、JavaScript が実行されていない可能性があります。

ページにどのようなエラーが表示されますか? JavaScript コンソールを確認してください。

于 2013-02-22T15:53:28.007 に答える