2016-03-28 5 views
0

Happy Easter Alle Ich versuche, ein Bild Link öffnen und schließen zu bekommen neben einem Dia Push-Menü bleibenBildposition Schlitten in Menü

das Menü ich verwende hier ist es das allererste

http://tympanus.net/Blueprints/SlidePushMenus/

die offen in der Nähe i wie hier mit dem Menü verschieben möchten

https://www.callofduty.com/blackops3/ce

wenn Sie loo k am menüsymbol bewegt es sich mit dem menü ... ich habe versucht neue div nichts hat funktioniert.

<nav class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-left" id="cbp-spmenu-s1"> 
      <h3>Menu</h3>    
      <a href="#">Celery seakale</a> 
      <a href="#">Dulse daikon</a> 
      <a href="#">Zucchini garlic</a> 
      <a href="#">Catsear azuki bean</a> 
      <a href="#">Dandelion bunya</a> 
      <a href="#">Rutabaga</a> 
    </nav> 



<button id="showLeft" class="btn2"><img src="content/media/icon-bar.jpg" alt="Menu"></button> 


/* General Demo Style */ 
@import url(http://fonts.googleapis.com/css?family=Lato:300,400,700); 

@font-face { 
    font-family: 'fontawesome'; 
    src:url('../fonts/fontawesome.eot'); 
    src:url('../fonts/fontawesome.eot?#iefix') format('embedded-opentype'), 
     url('../fonts/fontawesome.svg#fontawesome') format('svg'), 
     url('../fonts/fontawesome.woff') format('woff'), 
     url('../fonts/fontawesome.ttf') format('truetype'); 
    font-weight: normal; 
    font-style: normal; 
} 

body, html { font-size: 100%; padding: 0; margin: 0;} 

/* Reset */ 
*, 
*:after, 
*:before { 
    -webkit-box-sizing: border-box; 
    -moz-box-sizing: border-box; 
    box-sizing: border-box; 
} 

/* Clearfix hack by Nicolas Gallagher: http://nicolasgallagher.com/micro-clearfix-hack/ */ 
.clearfix:before, 
.clearfix:after { 
    content: " "; 
    display: table; 
} 

.clearfix:after { 
    clear: both; 
} 

body { 
    font-family: 'Lato', Calibri, Arial, sans-serif; 
    color: #47a3da; 

} 

a { 
    color: #f0f0f0; 
    text-decoration: none; 
} 

a:hover { 
    color: #000; 
} 

.main, 
.container > header { 
    width: 90%; 
    max-width: 69em; 
    margin: 0 auto; 
    padding: 0 1.875em 3.125em 1.875em; 
} 

.container > header { 
    padding: 2.875em 1.875em 1.875em; 
} 

.container > header h1 { 
    font-size: 2.125em; 
    line-height: 1.3; 
    margin: 0; 
    float: left; 
    font-weight: 400; 
} 

.container > header span { 
    display: block; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 0.5em; 
    padding: 0 0 0.6em 0.1em; 
} 

.container > header nav { 
    float: right; 
} 

.container > header nav a { 
    display: block; 
    float: left; 
    position: relative; 
    width: 2.5em; 
    height: 2.5em; 
    background: #fff; 
    border-radius: 50%; 
    color: transparent; 
    margin: 0 0.1em; 
    border: 4px solid #47a3da; 
    text-indent: -8000px; 
} 

.container > header nav a:after { 
    content: attr(data-info); 
    color: #47a3da; 
    position: absolute; 
    width: 600%; 
    top: 120%; 
    text-align: right; 
    right: 0; 
    opacity: 0; 
    pointer-events: none; 
} 

.container > header nav a:hover:after { 
    opacity: 1; 
} 

.container > header nav a:hover { 
    background: #47a3da; 
} 

.main > section { 
    max-width: 260px; 
    width: 90%; 
    margin: 0 auto; 
} 

.main > section h2 { 
    font-weight: 300; 
    color: #ccc; 
} 

.main > section button { 
    border: none; 
    background: #47a3da; 
    color: #fff; 
    padding: 1.5em; 
    display: block; 
    width: 100%; 
    cursor: pointer; 
    margin: 10px 0; 
    font-size: 0.8em; 
} 

.main > section button:hover { 
    background: #258ecd; 
} 

.main > section button.active { 
    background: #0d77b6; 
} 

.main > section button.disabled { 
    background: #aaa; 
    pointer-events: none; 
} 

.icon-drop:before, 
.icon-arrow-left:before { 
    font-family: 'fontawesome'; 
    position: absolute; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    speak: none; 
    font-style: normal; 
    font-weight: normal; 
    line-height: 2; 
    text-align: center; 
    color: #47a3da; 
    -webkit-font-smoothing: antialiased; 
    text-indent: 8000px; 
    padding-left: 8px; 
} 

.container > header nav a:hover:before { 
    color: #fff; 
} 

.icon-drop:before { 
    content: "\e000"; 
} 

.icon-arrow-left:before { 
    content: "\f060"; 
} 






/* General styles for all menus */ 
.cbp-spmenu { 
    background-image:url(../../media/opacityBG.png); 
    position: fixed; 
    margin-top: 50px; 
} 

.cbp-spmenu h3 { 
    color: #afdefa; 
    font-size: 1.9em; 
    padding: 20px; 
    margin: 0; 
    font-weight: 300; 
    background: #0d77b6; 
} 

.cbp-spmenu a { 
    display: block; 
    color: #fff; 
    font-size: 1.1em; 
    font-weight: 300; 
} 

.cbp-spmenu a:hover { 
    background: #258ecd; 
} 

.cbp-spmenu a:active { 
    background: #afdefa; 
    color: #47a3da; 
} 

/* Orientation-dependent styles for the content of the menu */ 

.cbp-spmenu-vertical { 
    width: 240px; 
    height: 100%; 
    top: 0; 
    z-index: 1000; 
} 

.cbp-spmenu-vertical a { 
    padding: 1em; 
} 

.cbp-spmenu-horizontal { 
    width: 100%; 
    height: 150px; 
    left: 0; 
    z-index: 1000; 
    overflow: hidden; 
} 

.cbp-spmenu-horizontal h3 { 
    height: 100%; 
    width: 20%; 
    float: left; 
} 

.cbp-spmenu-horizontal a { 
    float: left; 
    width: 20%; 
    padding: 0.8em; 
    border-left: 1px solid #258ecd; 
} 

/* Vertical menu that slides from the left or right */ 

.cbp-spmenu-left { 
    left: -240px; 
} 

.cbp-spmenu-right { 
    right: -240px; 
} 

.cbp-spmenu-left.cbp-spmenu-open { 
    left: 0px; 
} 

.cbp-spmenu-right.cbp-spmenu-open { 
    right: 0px; 
} 

/* Horizontal menu that slides from the top or bottom */ 

.cbp-spmenu-top { 
    top: -150px; 
} 

.cbp-spmenu-bottom { 
    bottom: -150px; 
} 

.cbp-spmenu-top.cbp-spmenu-open { 
    top: 0px; 
} 

.cbp-spmenu-bottom.cbp-spmenu-open { 
    bottom: 0px; 
} 

/* Push classes applied to the body */ 

.cbp-spmenu-push { 
    overflow-x: hidden; 
    position: relative; 
    left: 0; 
} 

.cbp-spmenu-push-toright { 
    left: 240px; 
} 

.cbp-spmenu-push-toleft { 
    left: -240px; 
} 

/* Transitions */ 

.cbp-spmenu, 
.cbp-spmenu-push { 
    -webkit-transition: all 0.3s ease; 
    -moz-transition: all 0.3s ease; 
    transition: all 0.3s ease; 
} 

/* Example media queries */ 

@media screen and (max-width: 55.1875em){ 

    .cbp-spmenu-horizontal { 
     font-size: 75%; 
     height: 110px; 
    } 

    .cbp-spmenu-top { 
     top: -110px; 
    } 

    .cbp-spmenu-bottom { 
     bottom: -110px; 
    } 

} 

@media screen and (max-height: 26.375em){ 

    .cbp-spmenu-vertical { 
     font-size: 90%; 
     width: 190px; 
    } 

    .cbp-spmenu-left, 
    .cbp-spmenu-push-toleft { 
     left: -190px; 
    } 

    .cbp-spmenu-right { 
     right: -190px; 
    } 

    .cbp-spmenu-push-toright { 
     left: 190px; 
    } 
} 
+2

Sie haben einen Code zu schreiben! – SaidbakR

+0

Einige Codes oder Geige würde helfen herauszufinden, was falsch ist –

+0

können Sie mir Ihre HTML, CSS, JS-Code senden, damit wir Ihnen helfen können. –

Antwort

0

unten ist die Arbeits Schnipsel gegeben. Hoffe, Sie werden sich freuen, die Lösung zu sehen.

var menuLeft = document.getElementById('cbp-spmenu-s1'), 
 
\t \t \t \t menuRight = document.getElementById('cbp-spmenu-s2'), 
 
\t \t \t \t menuTop = document.getElementById('cbp-spmenu-s3'), 
 
\t \t \t \t menuBottom = document.getElementById('cbp-spmenu-s4'), 
 
\t \t \t \t showLeft = document.getElementById('showLeft'), 
 
\t \t \t \t showRight = document.getElementById('showRight'), 
 
\t \t \t \t showTop = document.getElementById('showTop'), 
 
\t \t \t \t showBottom = document.getElementById('showBottom'), 
 
\t \t \t \t showLeftPush = document.getElementById('showLeftPush'), 
 
\t \t \t \t showRightPush = document.getElementById('showRightPush'), 
 
\t \t \t \t body = document.body; 
 

 
\t \t \t showLeft.onclick = function() { 
 
\t \t \t \t classie.toggle(this, 'active'); 
 
\t \t \t \t classie.toggle(menuLeft, 'cbp-spmenu-open'); 
 
\t \t \t \t disableOther('showLeft'); 
 
\t \t \t }; 
 
\t \t \t showRight.onclick = function() { 
 
\t \t \t \t classie.toggle(this, 'active'); 
 
\t \t \t \t classie.toggle(menuRight, 'cbp-spmenu-open'); 
 
\t \t \t \t disableOther('showRight'); 
 
\t \t \t }; 
 
\t \t \t showTop.onclick = function() { 
 
\t \t \t \t classie.toggle(this, 'active'); 
 
\t \t \t \t classie.toggle(menuTop, 'cbp-spmenu-open'); 
 
\t \t \t \t disableOther('showTop'); 
 
\t \t \t }; 
 
\t \t \t showBottom.onclick = function() { 
 
\t \t \t \t classie.toggle(this, 'active'); 
 
\t \t \t \t classie.toggle(menuBottom, 'cbp-spmenu-open'); 
 
\t \t \t \t disableOther('showBottom'); 
 
\t \t \t }; 
 
\t \t \t showLeftPush.onclick = function() { 
 
\t \t \t \t classie.toggle(this, 'active'); 
 
\t \t \t \t classie.toggle(body, 'cbp-spmenu-push-toright'); 
 
\t \t \t \t classie.toggle(menuLeft, 'cbp-spmenu-open'); 
 
\t \t \t \t disableOther('showLeftPush'); 
 
\t \t \t }; 
 
\t \t \t showRightPush.onclick = function() { 
 
\t \t \t \t classie.toggle(this, 'active'); 
 
\t \t \t \t classie.toggle(body, 'cbp-spmenu-push-toleft'); 
 
\t \t \t \t classie.toggle(menuRight, 'cbp-spmenu-open'); 
 
\t \t \t \t disableOther('showRightPush'); 
 
\t \t \t }; 
 

 
\t \t \t function disableOther(button) { 
 
\t \t \t \t if(button !== 'showLeft') { 
 
\t \t \t \t \t classie.toggle(showLeft, 'disabled'); 
 
\t \t \t \t } 
 
\t \t \t \t if(button !== 'showRight') { 
 
\t \t \t \t \t classie.toggle(showRight, 'disabled'); 
 
\t \t \t \t } 
 
\t \t \t \t if(button !== 'showTop') { 
 
\t \t \t \t \t classie.toggle(showTop, 'disabled'); 
 
\t \t \t \t } 
 
\t \t \t \t if(button !== 'showBottom') { 
 
\t \t \t \t \t classie.toggle(showBottom, 'disabled'); 
 
\t \t \t \t } 
 
\t \t \t \t if(button !== 'showLeftPush') { 
 
\t \t \t \t \t classie.toggle(showLeftPush, 'disabled'); 
 
\t \t \t \t } 
 
\t \t \t \t if(button !== 'showRightPush') { 
 
\t \t \t \t \t classie.toggle(showRightPush, 'disabled'); 
 
\t \t \t \t } 
 
\t \t \t }
/* General styles for all menus */ 
 
.cbp-spmenu { 
 
\t background: #47a3da; 
 
\t position: fixed; 
 
} 
 

 
.cbp-spmenu h3 { 
 
\t color: #afdefa; 
 
\t font-size: 1.9em; 
 
\t padding: 20px; 
 
\t margin: 0; 
 
\t font-weight: 300; 
 
\t background: #0d77b6; 
 
} 
 

 
.cbp-spmenu a { 
 
\t display: block; 
 
\t color: #fff; 
 
\t font-size: 1.1em; 
 
\t font-weight: 300; 
 
} 
 

 
.cbp-spmenu a:hover { 
 
\t background: #258ecd; 
 
} 
 

 
.cbp-spmenu a:active { 
 
\t background: #afdefa; 
 
\t color: #47a3da; 
 
} 
 

 
/* Orientation-dependent styles for the content of the menu */ 
 

 
.cbp-spmenu-vertical { 
 
\t width: 240px; 
 
\t height: 100%; 
 
\t top: 0; 
 
\t z-index: 1000; 
 
} 
 

 
.cbp-spmenu-vertical a { 
 
\t border-bottom: 1px solid #258ecd; 
 
\t padding: 1em; 
 
} 
 

 
.cbp-spmenu-horizontal { 
 
\t width: 100%; 
 
\t height: 150px; 
 
\t left: 0; 
 
\t z-index: 1000; 
 
\t overflow: hidden; 
 
} 
 

 
.cbp-spmenu-horizontal h3 { 
 
\t height: 100%; 
 
\t width: 20%; 
 
\t float: left; 
 
} 
 

 
.cbp-spmenu-horizontal a { 
 
\t float: left; 
 
\t width: 20%; 
 
\t padding: 0.8em; 
 
\t border-left: 1px solid #258ecd; 
 
} 
 

 
/* Vertical menu that slides from the left or right */ 
 

 
.cbp-spmenu-left { 
 
\t left: -240px; 
 
} 
 

 
.cbp-spmenu-right { 
 
\t right: -240px; 
 
} 
 

 
.cbp-spmenu-left.cbp-spmenu-open { 
 
\t left: 0px; 
 
} 
 

 
.cbp-spmenu-right.cbp-spmenu-open { 
 
\t right: 0px; 
 
} 
 

 
/* Horizontal menu that slides from the top or bottom */ 
 

 
.cbp-spmenu-top { 
 
\t top: -150px; 
 
} 
 

 
.cbp-spmenu-bottom { 
 
\t bottom: -150px; 
 
} 
 

 
.cbp-spmenu-top.cbp-spmenu-open { 
 
\t top: 0px; 
 
} 
 

 
.cbp-spmenu-bottom.cbp-spmenu-open { 
 
\t bottom: 0px; 
 
} 
 

 
/* Push classes applied to the body */ 
 

 
.cbp-spmenu-push { 
 
\t overflow-x: hidden; 
 
\t position: relative; 
 
\t left: 0; 
 
} 
 

 
.cbp-spmenu-push-toright { 
 
\t left: 240px; 
 
} 
 

 
.cbp-spmenu-push-toleft { 
 
\t left: -240px; 
 
} 
 

 
/* Transitions */ 
 

 
.cbp-spmenu, 
 
.cbp-spmenu-push { 
 
\t -webkit-transition: all 0.3s ease; 
 
\t -moz-transition: all 0.3s ease; 
 
\t transition: all 0.3s ease; 
 
} 
 

 
/* Example media queries */ 
 

 
@media screen and (max-width: 55.1875em){ 
 

 
\t .cbp-spmenu-horizontal { 
 
\t \t font-size: 75%; 
 
\t \t height: 110px; 
 
\t } 
 

 
\t .cbp-spmenu-top { 
 
\t \t top: -110px; 
 
\t } 
 

 
\t .cbp-spmenu-bottom { 
 
\t \t bottom: -110px; 
 
\t } 
 

 
} 
 

 
@media screen and (max-height: 26.375em){ 
 

 
\t .cbp-spmenu-vertical { 
 
\t \t font-size: 90%; 
 
\t \t width: 190px; 
 
\t } 
 

 
\t .cbp-spmenu-left, 
 
\t .cbp-spmenu-push-toleft { 
 
\t \t left: -190px; 
 
\t } 
 

 
\t .cbp-spmenu-right { 
 
\t \t right: -190px; 
 
\t } 
 

 
\t .cbp-spmenu-push-toright { 
 
\t \t left: 190px; 
 
\t } 
 
}
<script src="http://tympanus.net/codrops/adpacks/demoad.js"></script> 
 
<script src="http://tympanus.net/Blueprints/SlidePushMenus/js/classie.js"></script> 
 
<nav class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-left" id="cbp-spmenu-s1"> 
 
\t \t \t <h3>Menu</h3> 
 
\t \t \t <a href="#">Celery seakale</a> 
 
\t \t \t <a href="#">Dulse daikon</a> 
 
\t \t \t <a href="#">Zucchini garlic</a> 
 
\t \t \t <a href="#">Catsear azuki bean</a> 
 
\t \t \t <a href="#">Dandelion bunya</a> 
 
\t \t \t <a href="#">Rutabaga</a> 
 
<img class="menu-btn" style="position: absolute; right: -48px; top: 50px;" src="https://cdn4.iconfinder.com/data/icons/wirecons-free-vector-icons/32/menu-alt-48.png" id="showLeft"> 
 
\t \t </nav>

0

Setzen Sie das offene n schließt Bild in Ihrem Menü, und gerade die Art des Menüs Standard ändern (links), so dass es Teil des Menüs (der Bildteil)

Zum Beispiel in http://tympanus.net/Blueprints/SlidePushMenus/ zeigt der Standardstil ist .cbp-spmenu-left { links: -240px; }

wenn 240px ist die Breite des Menüs div, wenn Sie es 200px sein ändern, wird es 40 Pixel auf der rechten Seite des Menüs zeigen