Antworten auf deine Fragen:
Neues Thema erstellen

Java Script Menübalken...

GariZZo

Noch nicht viel geschrieben

Thema müsste heissen Java-Script Scrollmenü

Hallo zusammen,

ich habe zwar ein tutorial für mein Problem gefunden, jedoch funktioniert das ganze noch nicht, und deshalb hoffe ich, dass ihr mir helfen könnt.

Ich möchte quasi diese Funktion:
Create a Scrolling Menu: Result

und hab auch schritt für schritt das tutorial verfolgt.

Dennoch klappt es nicht wie ich es will:

Es scrollt nicht (geschweige, dass ich die Bilder nicht zentriert kriege)...

Ausserdem verweisst mich Dreamweaver, dass im allerletzten Code ein Fehler ist.
und zwar in der zeile:
Code:
var tooltip = $('<div class="sc_menu_tooltip"></div>')


Der gesammte html Code:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Werbeagentur Vision First - Main  // Hamburg, Germany</title>
<style type="text/css">
#Accordion1 .AccordionPanel .AccordionPanelTab strong {
	font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
	color: #aaf000;
}
#Accordion2 .AccordionPanel.AccordionPanelOpen .AccordionPanelContent table tr td {
	font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
	font-size: 14px;
}
.table2 {
	background-image: url(bilder/images/3.png);
	background-repeat: no-repeat;
}
#Accordion1 .AccordionPanel.AccordionPanelOpen .AccordionPanelContent table tr td {
	font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
	font-size: 14px;
	text-align: right;
}
body p {
	font-family: Arial, Helvetica, sans-serif;
}
body p {
	font-size: 10px;
}
body p {
	font-weight: bold;
}
body p {
	font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
}
body p {
	font-family: Arial, Helvetica, sans-serif;
}
body p {
	font-size: 12px;
}
body p {
	font-size: 10px;
}



div.sc_menu_wrapper {
  position: relative;
  height: 250px;
  /* Make bigger than a photo, because we need a place for a scroll-bar. */
  width: 200px;

  margin-top: 30px;
  overflow: auto;
}
div.sc_menu {
  padding: 15px 0;
}
.sc_menu a {
  display:block;
  margin-bottom: 1px;
  width: 155px;

  border: 2px rgb(79, 79, 79) solid;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;

  /* When image support is turned off */
  color: #fd7b2d;
  background: rgb(79, 79, 79);  
}
.sc_menu a:hover {
  border-color: rgb(253, 123, 45);
  border-style:solid;
}
.sc_menu img {
  display: block;
  border: none;
}

/* Styling tooltip */
.sc_menu_tooltip {
  display: block;
  position: absolute;

  padding: 6px;
  font-size: 12px;  
  color: #fff;

  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;

  border: 1px solid rgb(79, 79, 79);
  background: rgb(0, 0, 0);
  /* Make background a bit transparent for browsers that support rgba */    
  background: rgba(0, 0, 0, 0.5);
}



.table3 {
	background-image: url(bilder/images/iamges_input/images/content/page_slices_content_20.jpg);
	background-repeat: no-repeat;
}
</style>
<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>
<script src="film_stylesheet.js" type="text/javascript"></script>
</head>

<body onload="MM_preloadImages('bilder/images/iamges_input/images/buttons_06.png','bilder/images/iamges_input/images/buttons_08.png','bilder/images/iamges_input/images/buttons_10.png','bilder/images/iamges_input/images/buttons_12.png','bilder/images/iamges_input/images/content/page_slices_content_48.jpg','bilder/images/iamges_input/images/content/page_slices_content_50.jpg','bilder/images/iamges_input/images/content/page_slices_content_52.jpg')">
<div align="center">
  <table width="1075" height="790" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="117" colspan="11"><img src="bilder/images/iamges_input/images/input_01.png" width="1075" height="117" /></td>
        </tr>
      <tr>
        <td width="132" height="113" rowspan="3"><img src="bilder/images/iamges_input/images/input_02.png" width="132" height="113" /></td>
        <td width="122" height="113" rowspan="3"><img src="bilder/images/iamges_input/images/input_03.png" width="122" height="113" /></td>
        <td height="65" colspan="9"><img src="bilder/images/iamges_input/images/input_04.png" width="821" height="65" /></td>
        </tr>
      <tr>
        <td width="328" height="48" rowspan="2"><img src="bilder/images/iamges_input/images/input_05.png" width="328" height="48" /></td>
        <td width="34"><img src="bilder/images/iamges_input/images/buttons_06.png" width="34" height="17" /></td>
        <td width="7"><img src="bilder/images/iamges_input/images/input_07.png" width="7" height="17" /></td>
        <td width="113"><a href="kommunikation.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image15','','bilder/images/iamges_input/images/buttons_08.png',1)"><img src="bilder/images/iamges_input/images/input_08.png" name="Image15" width="113" height="17" border="0" id="Image15" /></a></td>
        <td width="8"><img src="bilder/images/iamges_input/images/input_09.png" width="8" height="17" /></td>
        <td width="80" height="17"><a href="fotografie.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image16','','bilder/images/iamges_input/images/buttons_10.png',1)"><img src="bilder/images/iamges_input/images/input_10.png" name="Image16" width="80" height="17" border="0" id="Image16" /></a></td>
        <td width="8" height="17"><img src="bilder/images/iamges_input/images/input_11.png" width="8" height="17" /></td>
        <td width="60" height="17"><a href="kontakt.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image17','','bilder/images/iamges_input/images/buttons_12.png',1)"><img src="bilder/images/iamges_input/images/input_12.png" name="Image17" width="60" height="17" border="0" id="Image17" /></a></td>
        <td width="183" height="48" rowspan="2"><img src="bilder/images/iamges_input/images/input_13.png" alt="" width="183" height="48" /></td>
      </tr>
      <tr>
        <td height="31" colspan="7"><img src="bilder/images/iamges_input/images/content/page_slices_content_14.png" width="310" height="31" /></td>
        </tr>
      <tr>
        <td height="298" colspan="11"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="50" colspan="12"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="1075" height="50"><img src="bilder/images/iamges_input/images/content/page_slices_content_15.jpg" width="1075" height="48" /></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td width="104" height="330" rowspan="5">&nbsp;</td>
            <td width="160" height="330" rowspan="5" class="table3"><div class="sc_menu_wrapper">
  <div class="sc_menu">
    <a title="Menu" href="#"><img src="bilder/1.jpg" alt="Menu"/ align="middle"></a>
    <a title="Navigation" href="#"><img src="bilder/1.jpg" alt="Navigation"/></a>
    <a title="jQuery" href="#"><img src="bilder/1.jpg" alt="jQuery"/></a>        
    <a title="CSS" href="#"><img src="bilder/1.jpg" alt="CSS"/></a>
    <a title="Vertical" href="#"><img src="bilder/1.jpg" alt="Vertical"/></a>
    <a title="Menu" href="#"><img src="bilder/1.jpg" alt="Menu"/></a>
    <a title="Navigation" href="#"><img src="bilder/1.jpg" alt="Navigation"/></a>    
  </div>
</div>
</td>
            <td width="58" rowspan="5">&nbsp;</td>
            <td width="154" height="86">&nbsp;</td>
            <td width="15" height="86">&nbsp;</td>
            <td width="154" height="86">&nbsp;</td>
            <td width="15" height="86">&nbsp;</td>
            <td width="154" height="86">&nbsp;</td>
            <td width="14" height="86">&nbsp;</td>
            <td width="154" height="88">&nbsp;</td>
            <td width="14">&nbsp;</td>
            <td width="79">&nbsp;</td>
            </tr>
          <tr>
            <td height="35" colspan="7">&nbsp;</td>
            <td width="14" height="35">&nbsp;</td>
            <td width="79" height="35">&nbsp;</td>
            </tr>
          <tr>
            <td width="154" height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td width="154" height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td width="154" height="86">&nbsp;</td>
            <td width="14" height="86">&nbsp;</td>
            <td width="79" height="86">&nbsp;</td>
            </tr>
          <tr>
            <td height="35" colspan="7">&nbsp;</td>
            <td width="14" height="35">&nbsp;</td>
            <td width="79" height="35">&nbsp;</td>
            </tr>
          <tr>
            <td width="154" height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td width="154" height="86">&nbsp;</td>
            <td width="14" height="86">&nbsp;</td>
            <td width="79" height="86">&nbsp;</td>
            </tr>
        </table></td>
        </tr>
      <tr>
        <td height="116" colspan="11"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="1075" height="116"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="322" height="116" rowspan="3">&nbsp;</td>
                <td height="16" colspan="4">&nbsp;</td>
                <td width="482" height="16">&nbsp;</td>
                <td width="46">&nbsp;</td>
                <td height="16">&nbsp;</td>
                </tr>
              <tr>
                <td width="42" height="26"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image19','','bilder/images/iamges_input/images/content/page_slices_content_48.jpg',1)"><img src="bilder/images/iamges_input/images/content/Film_buttons_48.jpg" name="Image19" width="42" height="26" border="0" id="Image19" /></a></td>
                <td width="7" height="26">&nbsp;</td>
                <td width="92" height="26"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image20','','bilder/images/iamges_input/images/content/page_slices_content_50.jpg',1)"><img src="bilder/images/iamges_input/images/content/Film_buttons_50.jpg" name="Image20" width="92" height="26" border="0" id="Image20" /></a></td>
                <td width="7" height="26">&nbsp;</td>
                <td height="26" colspan="2"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image21','','bilder/images/iamges_input/images/content/page_slices_content_52.jpg',1)"><img src="bilder/images/iamges_input/images/content/Film_buttons_52.jpg" name="Image21" width="53" height="26" border="0" id="Image21" /></a></td>
                <td width="77">&nbsp;</td>
              </tr>
              <tr>
                <td height="71" colspan="7">&nbsp;</td>
                </tr>
            </table></td>
          </tr>
        </table></td>
        </tr>
      <tr>
        <td height="65" colspan="11"><img src="bilder/images/iamges_input/images/input_17.png" width="1075" height="65" /></td>
        </tr>
    </table></td>
  </tr>
  </table>
</div>
</body>
</html>


Der Java-Script Code:

Code:
// JavaScript Document


function makeScrollable(wrapper, scrollable){
}
$(function(){   
  makeScrollable("div.sc_menu_wrapper", "div.sc_menu");
});


function makeScrollable(wrapper, scrollable){
  // Get jQuery elements
  var wrapper = $(wrapper), scrollable = $(scrollable);

  // Hide images until they are not loaded
  scrollable.hide();
  var loading = $("<div class='loading'></div>").appendTo(wrapper);

  // Set function that will check if all images are loaded
  var interval = setInterval(function(){
    var images = scrollable.find("img");
    var completed = 0;

    // Counts number of images that are succesfully loaded
    images.each(function(){
      if (this.complete) completed++;   
    });

    if (completed == images.length){
      clearInterval(interval);
      // Timeout added to fix problem with Chrome
      setTimeout(function(){

        loading.hide();
        // Remove scrollbars    
        wrapper.css({overflow: "hidden"});

        scrollable.slideDown("slow", function(){
          enable(); 
        });                 
      }, 1000); 
    }
  }, 100);

  function enable(){            
  }
}


function enable(){
  // height of area at the top at bottom, that don't respond to mousemove
  var inactiveMargin = 100;         
  // Cache for performance
  var wrapperWidth = wrapper.width();
  var wrapperHeight = wrapper.height();
  // Using outer height to include padding too
  var scrollableHeight = scrollable.outerHeight() + 2*inactiveMargin;
  // Do not cache wrapperOffset, because it can change when user resizes window
  // We could use onresize event, but it's just not worth doing that 
  // var wrapperOffset = wrapper.offset();

  //When user move mouse over menu          
  wrapper.mousemove(function(e){
    var wrapperOffset = wrapper.offset();
    // Scroll menu
    var top = (e.pageY -  wrapperOffset.top) * (scrollableHeight - wrapperHeight) / wrapperHeight  - inactiveMargin;

    if (top < 0){
      top = 0;
    }

    wrapper.scrollTop(top);
  });       
}



function enable(){  
  // height of area at the top at bottom, that don't respond to mousemove
  var inactiveMargin = 100;     
  // Cache for performance
  var wrapperWidth = wrapper.width();
  var wrapperHeight = wrapper.height();
  // Using outer height to include padding too
  var scrollableHeight = scrollable.outerHeight() + 2*inactiveMargin;
  // Do not cache wrapperOffset, because it can change when user resizes window
  // We could use onresize event, but it's just not worth doing that 
  // var wrapperOffset = wrapper.offset();

  // Create a invisible tooltip
  var tooltip = $('&lt;div class=&quot;sc_menu_tooltip&quot;&gt;&lt;/div&gt;')
    .css('opacity', 0)
    .appendTo(wrapper);

  // Save menu titles
  scrollable.find('a').each(function(){             
    // The "data" function attaches custom data to an element
    $(this).data('tooltipText', this.title);                
  });

  // Remove default tooltip
  scrollable.find('a').removeAttr('title');     
  // Remove default tooltip in IE
  scrollable.find('img').removeAttr('alt');

  var lastTarget;
  //When user move mouse over menu          
  wrapper.mousemove(function(e){
    // Save target
    lastTarget = e.target;

    var wrapperOffset = wrapper.offset();

    var tooltipLeft = e.pageX - wrapperOffset.left;
    // Do not let tooltip to move out of menu.
    // Because overflow is set to hidden, we will not be able too see it 
    tooltipLeft = Math.min(tooltipLeft, wrapperWidth - 75); //tooltip.outerWidth());

    var tooltipTop = e.pageY - wrapperOffset.top   wrapper.scrollTop() - 40;
    // Move tooltip under the mouse when we are in the higher part of the menu
    if (e.pageY - wrapperOffset.top &lt; wrapperHeight/2){
      tooltipTop  = 80;
    }               
    tooltip.css({top: tooltipTop, left: tooltipLeft});

    // Scroll menu
    var top = (e.pageY -  wrapperOffset.top) * (scrollableHeight - wrapperHeight) / wrapperHeight  - inactiveMargin;

    if (top < 0){
      top = 0;
    }
    wrapper.scrollTop(top);
  });

  // Setting interval helps solving perfomance problems in IE
  var interval = setInterval(function(){
    if (!lastTarget) return;

    var currentText = tooltip.text();

    if (lastTarget.nodeName == 'IMG'){                  
      // We've attached data to a link, not image
      var newText = $(lastTarget).parent().data('tooltipText');

      // Show tooltip with the new text
      if (currentText != newText) {
        tooltip
          .stop(true)
          .css('opacity', 0)    
          .text(newText)
          .animate({opacity: 1}, 1000);
      }                 
    }
  }, 200);

  // Hide tooltip when leaving menu
  wrapper.mouseleave(function(){
    lastTarget = false;
    tooltip.stop(true).css('opacity', 0).text('');
  });           
}

Ich hoffe ihr könnt mir helfen...

MfG
GariZZo
 

stroyer

Aktives Mitglied

AW: Java Script Menübalken...

ein Fehler ist folgender in der JS:
Code:
  function enable(){            
  }
}


function enable(){
Die function enable gehört nicht extra sondern oben eingefügt.

Du hast ein paar Funktionen doppelt drinnen. Im Tutorial werden die von Schritt zu Schritt ergänzt.
Der richtige JS-Code:

Code:
function makeScrollable(wrapper, scrollable){
    // Get jQuery elements
    var wrapper = $(wrapper), scrollable = $(scrollable);
    
    // Hide images until they are not loaded
    scrollable.hide();
    var loading = $('<div class="loading">Loading...</div>').appendTo(wrapper);
    
    // Set function that will check if all images are loaded
    var interval = setInterval(function(){
        var images = scrollable.find('img');
        var completed = 0;
        
        // Counts number of images that are succesfully loaded
        images.each(function(){
            if (this.complete) completed++;    
        });
        
        if (completed == images.length){
            clearInterval(interval);
            // Timeout added to fix problem with Chrome
            setTimeout(function(){
                
                loading.hide();
                // Remove scrollbars    
                wrapper.css({overflow: 'hidden'});                        
                
                scrollable.slideDown('slow', function(){
                    enable();    
                });                    
            }, 1000);    
        }
    }, 100);
    
    function enable(){
        // height of area at the top at bottom, that don't respond to mousemove
        var inactiveMargin = 99;                    
        // Cache for performance
        var wrapperWidth = wrapper.width();
        var wrapperHeight = wrapper.height();
        // Using outer height to include padding too
        var scrollableHeight = scrollable.outerHeight() + 2*inactiveMargin;
        // Do not cache wrapperOffset, because it can change when user resizes window
        // We could use onresize event, but it's just not worth doing that 
        // var wrapperOffset = wrapper.offset();
        
        // Create a invisible tooltip
        var tooltip = $('<div class="sc_menu_tooltip"></div>')
            .css('opacity', 0)
            .appendTo(wrapper);
    
        // Save menu titles
        scrollable.find('a').each(function(){                
            $(this).data('tooltipText', this.title);                
        });
        
        // Remove default tooltip
        scrollable.find('a').removeAttr('title');        
        // Remove default tooltip in IE
        scrollable.find('img').removeAttr('alt');    
        
        var lastTarget;
        //When user move mouse over menu            
        wrapper.mousemove(function(e){
            // Save target
            lastTarget = e.target;

            var wrapperOffset = wrapper.offset();
        
            var tooltipLeft = e.pageX - wrapperOffset.left;
            // Do not let tooltip to move out of menu.
            // Because overflow is set to hidden, we will not be able too see it 
            tooltipLeft = Math.min(tooltipLeft, wrapperWidth - 75); //tooltip.outerWidth());
            
            var tooltipTop = e.pageY - wrapperOffset.top + wrapper.scrollTop() - 40;
            // Move tooltip under the mouse when we are in the higher part of the menu
            if (e.pageY - wrapperOffset.top < wrapperHeight/2){
                tooltipTop += 80;
            }                
            tooltip.css({top: tooltipTop, left: tooltipLeft});                
            
            // Scroll menu
            var top = (e.pageY -  wrapperOffset.top) * (scrollableHeight - wrapperHeight) / wrapperHeight - inactiveMargin;
            if (top < 0){
                top = 0;
            }            
            wrapper.scrollTop(top);
        });
        
        // Setting interval helps solving perfomance problems in IE
        var interval = setInterval(function(){
            if (!lastTarget) return;    
                                        
            var currentText = tooltip.text();
            
            if (lastTarget.nodeName == 'IMG'){                    
                // We've attached data to a link, not image
                var newText = $(lastTarget).parent().data('tooltipText');

                // Show tooltip with the new text
                if (currentText != newText) {
                    tooltip
                        .stop(true)
                        .css('opacity', 0)    
                        .text(newText)
                        .animate({opacity: 1}, 1000);
                }                    
            }
        }, 200);
        
        // Hide tooltip when leaving menu
        wrapper.mouseleave(function(){
            lastTarget = false;
            tooltip.stop(true).css('opacity', 0).text('');
        });            
        
        /*
        //Usage of hover event resulted in performance problems
        scrollable.find('a').hover(function(){
            tooltip
                .stop()
                .css('opacity', 0)
                .text($(this).data('tooltipText'))
                .animate({opacity: 1}, 1000);
    
        }, function(){
            tooltip
                .stop()
                .animate({opacity: 0}, 300);
        });
        */            
    }
}
    
$(function(){    
    makeScrollable("div.sc_menu_wrapper", "div.sc_menu");
});
Bezüglich Dreamweaver: Kann sein, dass hinten ein Strichpunkt fehlt?

CSS von
Code:
body p { 	font-family: Arial, Helvetica, sans-serif; } body p { 	font-size: 10px; } body p { 	font-weight: bold; } body p { 	font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; } body p { 	font-family: Arial, Helvetica, sans-serif; } body p { 	font-size: 12px; } body p { 	font-size: 10px; }
könntest du zusammenfassen, der erzeugte Code vom DW ist wie gewohnt schrecklich, was aber nichts an der Funktionalität ändert.
 
Zuletzt bearbeitet:

GariZZo

Noch nicht viel geschrieben

Oh tatsächlich, es fehlte der Strichpunkt...
Du hast mir sehr geholfen!!

VIELEN DANK!!

Ach noch eine Frage, ich bekomm die Bilder vom Menübalken nicht zentriert... ;/
 
Zuletzt bearbeitet von einem Moderator:

GariZZo

Noch nicht viel geschrieben

Ok ich hab ein neues Problem,

und zwar funktionieren bei mir mehrere JavaScript Funktionen nicht.
Kurioserweiser nach Positionieren im Head Bereich. Ich hab zum einen die Nav Links mit der JS was ich oben gepostet hab, und nun soll noch eine MultiBox (LightBox) noch auf die Seite. Wenn ich die JS Headzeile vor der JS-Funktion der Navigation setzte, funktioniert meine Lightbox nicht mehr, wenn ich aber die JS-Zeile nach der JS-Funktion der Navi setzte, funktioniert die Lightbox, aber meine Navileiste Links bekommt scrollbalken und es verschiebt sich...

Also so:
Code:
<script type="text/javascript" src="multibox/mootools.js"></script>
<script type="text/javascript" src="multibox/multibox.js"></script>
<script type="text/javascript" src="multibox/overlay.js"></script>


<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>
<script src="film_stylesheet.js" type="text/javascript"></script>
Funktioniert meine Lightbox nicht...

und so:
Code:
<script type="text/javascript" src="multibox/mootools.js"></script>
<script type="text/javascript" src="multibox/multibox.js"></script>
<script type="text/javascript" src="multibox/overlay.js"></script>


<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="multibox/mootools.js"></script>
<script type="text/javascript" src="multibox/multibox.js"></script>
<script type="text/javascript" src="multibox/overlay.js"></script>


<script src="film_stylesheet.js" type="text/javascript"></script>
funktioniert meine Lightbox, aber meine Navileiste bekommt scrollbalken etc...

Wo ist das Prob? Man kann doch nicht etwa eine JS-Funktion anwenden oder?

Ah ne nicht vor der Navi JS Funktion sondern vor oder nach der
Code:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>
Zeile

Hmm ich glaube das Liegt dadran das die jquerry.js und die von der Multibox (mootools.js) sich ziemlich ähneln!
 
Zuletzt bearbeitet von einem Moderator:

stroyer

Aktives Mitglied

AW: Java Script Menübalken...

jQuery und Mootools ähneln sich in der Tat (zB beide verwenden die $-Funktion aber der Parameter ist unterschiedlich). Es gibt zwar Möglichkeiten unter jQuery eine benutzerdefinierte jQuery Funktion statt $ zu definieren, aber dann muss der ganze Code, der von jQuery abhängt umgeschrieben werden.
Prinzipiell ist es zu empfehlen sich für ein Javascript-Framework (ich würde jQuery bevorzugen) zu entscheiden und alles schauen mit dem zu lösen.
Für jQuery gibt es genug Lightboxes, zB. ()
 

GariZZo

Noch nicht viel geschrieben

Das probier ich mal aus, danke erstmal! Meld mich sicherlich! ;)


Edit:
Also irgendwie kommt es mit dem jQuery Plugin auch in die quere... Wo denk ich falsch?
 
Zuletzt bearbeitet von einem Moderator:

stroyer

Aktives Mitglied

AW: Java Script Menübalken...

Mootools Script und Multiboxscripte alles herausgenommen?
nichts doppelt (zB jquery) eingefügt?
Hast du eine Version online?
bzw. was sagen debugger wie unter Firefox die Fehlerkonsole (Strg+Umschalt+J)?
 

GariZZo

Noch nicht viel geschrieben

AW: Java Script Menübalken...

Ja die Alten Scripte sind raus, habs es mal geuppt:



Die Lightbox ist eingefügt, aber funtz nicht :(

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Werbeagentur Vision First - Main  // Hamburg, Germany</title>

<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>
<script src="film_stylesheet.js" type="text/javascript"></script>

    <link rel="stylesheet" type="text/css" href="../style-projects-jquery.css" /> 
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/jquery.lightbox-0.5.js"></script>
    <link rel="stylesheet" type="text/css" href="css/jquery.lightbox-0.5.css" media="screen" />
    
        <script type="text/javascript">
    $(function() {
        $('#gallery a').lightBox();
    });
    </script>

    
<style type="text/css">
#Accordion1 .AccordionPanel .AccordionPanelTab strong {
	font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
	color: #aaf000;
}
#Accordion2 .AccordionPanel.AccordionPanelOpen .AccordionPanelContent table tr td {
	font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
	font-size: 14px;
}
.table2 {
	background-image: url(bilder/images/3.png);
	background-repeat: no-repeat;
}
#Accordion1 .AccordionPanel.AccordionPanelOpen .AccordionPanelContent table tr td {
	font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
	font-size: 14px;
	text-align: right;
}
body p {
	font-family: Arial, Helvetica, sans-serif;
}
body p {
	font-size: 10px;
}
body p {
	font-weight: bold;
}
body p {
	font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
}
body p {
	font-family: Arial, Helvetica, sans-serif;
}
body p {
	font-size: 12px;
}
body p {
	font-size: 10px;
}



div.sc_menu_wrapper {
  position: relative;   
  height: 280px;
  /* Make bigger than a photo, because we need a place for a scroll-bar. */
  width: 160px;

  margin-top: 10px;
  overflow: auto;
}
div.sc_menu {
  padding: 1px 11px;
  text-align:center;

}
.sc_menu a {
  display: block;
  width: 130px;
  margin-bottom: 2px;

  border: 4px rgb(79, 79, 79) solid;
  -webkit-border-radius: 0px;
  -moz-border-radius: 0px;

  /* When image support is turned off */
  color: #fd7b2d;
  background: rgb(79, 79, 79);  
}
.sc_menu a:hover {
  border-color: rgb(253, 123, 45);
  border-style:solid;
}
.sc_menu img {
  
  border: none;
}


.sc_menu_wrapper .loading {
  position: absolute;
  top: 50px;
  left: 20px;

  margin: 0 auto;
  padding: 10px;

  width: 100px;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;

  text-align: center;
  color: #fff;
  border: 1px solid rgb(79, 79, 79);
  background: #1F1D1D;
}



.table3 {
	background-image: url(bilder/images/iamges_input/images/content/page_slices_content_20.jpg);
	background-repeat: no-repeat;
}
.fontabc {
	font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
	font-size: 12px;
}
</style>


</head>

<body onload="MM_preloadImages('bilder/images/iamges_input/images/buttons_06.png','bilder/images/iamges_input/images/buttons_08.png','bilder/images/iamges_input/images/buttons_10.png','bilder/images/iamges_input/images/buttons_12.png','bilder/images/iamges_input/images/content/page_slices_content_48.jpg','bilder/images/iamges_input/images/content/page_slices_content_50.jpg','bilder/images/iamges_input/images/content/page_slices_content_52.jpg','bilder/1a.jpg')" alink="#000000" link="#000000" vlink="#000000">
<div align="center">
  <table width="1075" height="790" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="117" colspan="11"><img src="bilder/images/iamges_input/images/input_01.png" width="1075" height="117" /></td>
        </tr>
      <tr>
        <td width="132" height="113" rowspan="3"><img src="bilder/images/iamges_input/images/input_02.png" width="132" height="113" /></td>
        <td width="122" height="113" rowspan="3"><img src="bilder/images/iamges_input/images/input_03.png" width="122" height="113" /></td>
        <td height="65" colspan="9"><img src="bilder/images/iamges_input/images/input_04.png" width="821" height="65" /></td>
        </tr>
      <tr>
        <td width="328" height="48" rowspan="2"><img src="bilder/images/iamges_input/images/input_05.png" width="328" height="48" /></td>
        <td width="34"><img src="bilder/images/iamges_input/images/buttons_06.png" width="34" height="17" /></td>
        <td width="7"><img src="bilder/images/iamges_input/images/input_07.png" width="7" height="17" /></td>
        <td width="113"><a href="kommunikation.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image15','','bilder/images/iamges_input/images/buttons_08.png',1)"><img src="bilder/images/iamges_input/images/input_08.png" name="Image15" width="113" height="17" border="0" id="Image15" /></a></td>
        <td width="8"><img src="bilder/images/iamges_input/images/input_09.png" width="8" height="17" /></td>
        <td width="80" height="17"><a href="fotografie.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image16','','bilder/images/iamges_input/images/buttons_10.png',1)"><img src="bilder/images/iamges_input/images/input_10.png" name="Image16" width="80" height="17" border="0" id="Image16" /></a></td>
        <td width="8" height="17"><img src="bilder/images/iamges_input/images/input_11.png" width="8" height="17" /></td>
        <td width="60" height="17"><a href="kontakt.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image17','','bilder/images/iamges_input/images/buttons_12.png',1)"><img src="bilder/images/iamges_input/images/input_12.png" name="Image17" width="60" height="17" border="0" id="Image17" /></a></td>
        <td width="183" height="48" rowspan="2"><img src="bilder/images/iamges_input/images/input_13.png" alt="" width="183" height="48" /></td>
      </tr>
      <tr>
        <td height="31" colspan="7"><img src="bilder/images/iamges_input/images/content/page_slices_content_14.png" width="310" height="31" /></td>
        </tr>
      <tr>
        <td height="298" colspan="11"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="50" colspan="12"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="1075" height="50"><img src="bilder/images/iamges_input/images/content/page_slices_content_15.jpg" width="1075" height="48" /></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td width="104" height="330" rowspan="7">&nbsp;</td>
            <td width="160" height="330" rowspan="7" class="table3"><div class="sc_menu_wrapper">
  <div class="sc_menu">
    <a href="film_checker.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image27','','bilder/1a.jpg',1)"><img src="bilder/1.jpg" name="Image27" width="128" height="40" border="0" id="Image27" /></a>
    <a title="Navigation" href="#"><img src="bilder/1.jpg" alt="Navigation"/></a>
    <a title="jQuery" href="#"><img src="bilder/1.jpg" alt="jQuery"/></a>        
    <a title="CSS" href="#"><img src="bilder/1.jpg" alt="CSS"/></a>
    <a title="Vertical" href="#"><img src="bilder/1.jpg" alt="Vertical"/></a>
    <a title="Menu" href="#"><img src="bilder/1.jpg" alt="Menu"/></a>
    <a title="Navigation" href="#"><img src="bilder/1.jpg" alt="Navigation"/></a>    
  </div>
</div>
</td>
            <td width="58" rowspan="7">&nbsp;</td>
            <td width="154" height="86"><a href="photos/checker01_g.jpg" title="Utilize a flexibilidade dos seletores da jQuery e crie um grupo de imagens como desejar. $('#gallery').lightBox();">
                <img src="photos/checker01_k.jpg" width="154" height="86" alt="" />            </a></td>
            <td width="15" height="86">&nbsp;</td>
            <td width="154" height="86">&nbsp;</td>
            <td width="15" height="86">&nbsp;</td>
            <td width="154" height="86">&nbsp;</td>
            <td width="14" height="86">&nbsp;</td>
            <td width="154" height="88">&nbsp;</td>
            <td width="14">&nbsp;</td>
            <td width="79">&nbsp;</td>
            </tr>
          <tr>
            <td height="17" class="fontabc">Checker Part 1</td>
            <td height="17">&nbsp;</td>
            <td height="17" class="fontabc">Checker Part2</td>
            <td height="17">&nbsp;</td>
            <td height="17" class="fontabc">Checker Part 3</td>
            <td height="17">&nbsp;</td>
            <td height="17" class="fontabc">Checker Part 4</td>
            <td width="14" height="35" rowspan="2">&nbsp;</td>
            <td width="79" height="35" rowspan="2">&nbsp;</td>
            </tr>
          <tr>
            <td height="18" colspan="6">&nbsp;</td>
            <td height="18">&nbsp;</td>
          </tr>
          <tr>
            <td width="154" height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td width="154" height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td width="154" height="86">&nbsp;</td>
            <td width="14" height="86">&nbsp;</td>
            <td width="79" height="86">&nbsp;</td>
            </tr>
          <tr>
            <td height="17" class="fontabc">Checker Part 5</td>
            <td height="17">&nbsp;</td>
            <td height="17" class="fontabc">Checker Part 6</td>
            <td height="17">&nbsp;</td>
            <td height="17" class="fontabc">Checker Part 7</td>
            <td height="17">&nbsp;</td>
            <td height="17" class="fontabc">Checker Part 8</td>
            <td width="14" height="35" rowspan="2">&nbsp;</td>
            <td width="79" height="35" rowspan="2">&nbsp;</td>
            </tr>
          <tr>
            <td height="18" colspan="7">&nbsp;</td>
          </tr>
          <tr>
            <td width="154" height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td height="86">&nbsp;</td>
            <td width="154" height="86">&nbsp;</td>
            <td width="14" height="86">&nbsp;</td>
            <td width="79" height="86">&nbsp;</td>
            </tr>
        </table></td>
        </tr>
      <tr>
        <td height="116" colspan="11"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="1075" height="116"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="322" height="116" rowspan="5">&nbsp; </td>
                <td height="18" colspan="4" class="fontabc">Checker Part 9</td>
                <td width="28" height="18">&nbsp;</td>
                <td width="167"><span class="fontabc">Checker Part 10</span></td>
                <td width="154"><span class="fontabc">Checker Part 11</span></td>
                <td width="15">&nbsp;</td>
                <td width="112"><span class="fontabc">Checker Part 12</span></td>
                <td width="42"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','bilder/images/iamges_input/images/content/page_slices_content_48.jpg',1)"></a></td>
                <td height="36" rowspan="2">&nbsp;</td>
                </tr>
              <tr>
                <td height="18" colspan="4" class="fontabc">&nbsp;</td>
                <td height="18" colspan="5">&nbsp;</td>
                <td width="42"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','bilder/images/iamges_input/images/content/page_slices_content_48.jpg',1)"><img src="bilder/images/iamges_input/images/content/Film_buttons_48.jpg" alt="" name="Image1" width="42" height="26" border="0" id="Image1" /></a></td>
              </tr>
              <tr>
                <td width="42" height="26"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image19','','bilder/images/iamges_input/images/content/page_slices_content_48.jpg',1)"><img src="bilder/images/iamges_input/images/content/Film_buttons_48.jpg" name="Image19" width="42" height="26" border="0" id="Image19" /></a></td>
                <td width="4" height="26">&nbsp;</td>
                <td width="92" height="26"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image20','','bilder/images/iamges_input/images/content/page_slices_content_50.jpg',1)"><img src="bilder/images/iamges_input/images/content/Film_buttons_50.jpg" name="Image20" width="92" height="26" border="0" id="Image20" /></a></td>
                <td width="4" height="26">&nbsp;</td>
                <td height="26" colspan="6"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image21','','bilder/images/iamges_input/images/content/page_slices_content_52.jpg',1)"><img src="bilder/images/iamges_input/images/content/Film_buttons_52.jpg" name="Image21" width="53" height="26" border="0" id="Image21" /></a></td>
                <td width="93">&nbsp;</td>
              </tr>
              <tr>
                <td height="19" colspan="11"><span class="fontabc">Checker</span></td>
                </tr>
              <tr>
                <td height="36" colspan="11">&nbsp;</td>
              </tr>
            </table></td>
          </tr>
        </table></td>
        </tr>
      <tr>
        <td height="65" colspan="11"><img src="bilder/images/iamges_input/images/input_17.png" width="1075" height="65" /></td>
        </tr>
    </table></td>
  </tr>
  </table>
</div>
</body>
</html>
 

stroyer

Aktives Mitglied

AW: Java Script Menübalken...

das, was ich gemeint habe:
Code:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src=""></script>
nimm das untere mal raus...
 

stroyer

Aktives Mitglied

AW: Java Script Menübalken...

es gibt nirgends im HTML-Code ein Element mit der id gallery, dass einen link enthält ( $('#gallery a')). Drinnen das muss so zu sagen der CSS-Selektor für alle Links der Lightbox sein. weise jedem link die class gallery1 zu und verwende dann $('.gallery1') , dann sollte es gehen.
 
Bilder bitte hier hochladen und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Antworten auf deine Fragen:
Neues Thema erstellen

Willkommen auf PSD-Tutorials.de

In unseren Foren vernetzt du dich mit anderen Personen, um dich rund um die Themen Fotografie, Grafik, Gestaltung, Bildbearbeitung und 3D auszutauschen. Außerdem schalten wir für dich regelmäßig kostenlose Inhalte frei. Liebe Grüße senden dir die PSD-Gründer Stefan und Matthias Petri aus Waren an der Müritz. Hier erfährst du mehr über uns.

Stefan und Matthias Petri von PSD-Tutorials.de

Nächster neuer Gratisinhalt

03
Stunden
:
:
25
Minuten
:
:
19
Sekunden

Flatrate für Tutorials, Assets, Vorlagen

Zurzeit aktive Besucher

Statistik des Forums

Themen
118.611
Beiträge
1.538.341
Mitglieder
67.524
Neuestes Mitglied
BSKGA
Oben