Antworten auf deine Fragen:
Neues Thema erstellen

Antworten zum Thema „Slider slidet einfach nicht. - HILFE“

sokie

Mod | Web

AW: Slider slidet einfach nicht. - HILFE

es wäre gut, wenn du zunächst die Beispiele aus deinem Code löschen würdest und nur das notieren, was für deine Funktion wirklich relevant ist.
 

Llynyania

Benutzertitel aberkannt

AW: Slider slidet einfach nicht. - HILFE

Schiebe das Script ab: <!-- Javascripts... bis </script> in den Headbereich

Nachtrag: Du solltest Ordnung in die Dateien bringen. Du hast bereits eine css, da können doch alle Anweisungen, die jetzt noch in der html stehen ausgelagert werden.
Prüfe, ob die Pfade zu den .js Dateien korrekt sind. Manchmal hat man die Ordner ein wenig durcheinander verschachtelt und es passt nicht zum Originaltemplate.

Grüßle
 
Zuletzt bearbeitet:

Duddle

Posting-Frequenz: 14µHz

AW: Slider slidet einfach nicht. - HILFE

Falls du Firefox hast, installier dir mal Firebug. Da hast du u.a. eine sehr gute Fehlerkonsole, die mir bei dir sofort 2 Fehler anzeigt:
Code:
missing ; before statement
http://dominikgeisler.de/DG/jquery.slideshow.js
Line 273

$(".simpleSlideShow, .slideShowTopNavi").slideShow is not a function
http://dominikgeisler.de/DG/index.html
Line 123
Der erste Fehler zeigt auf diese Zeile:
Code:
			if (noanimation)Â {
und dort ist ja offensichtlich, was falsch ist.

Der zweite meckert über das:
Code:
122 $('.simpleSlideShow, .slideShowTopNavi').slideShow({
123 interval: 3,
124 });
Da muss in Zeile 123 vermutlich das Komma raus, sonst erwartet er noch irgendetwas.


Duddle
 

Foos

Member

AW: Slider slidet einfach nicht. - HILFE

hmmm, das komische ist halt, das ich das Script komplett einfach in meine Seite kopiert habe und Pfade usw. stimmen aber. Ich checks nich. Die Fehler die Firebug anzeigt, hab ich behoben hilft nichts:
Hier nochmal der Code, welchen ich vom Script in meine Seite übernommen habe:

Code:
<style type="text/css">
        
        
        .faded, .faded a {
            color: #B2B2B2 !important;
        }
        .slideShow ul, .slideShow li {
            list-style-type: none;
            margin: 0px;
            padding: 0px;
        }

        
        /* slideshow styles */
        .slideShow {
            padding: 0px; border: none; display: table;
            clear: both;
            margin-bottom: 10px;
        }
        .slideShow .navigation {
            margin-top: 10px;
            clear: left;
            display: block;
        }
        .slideShow .navigation a {
            background-color: #B3B3B3;
            margin: 0px 2px 0px 0px;
            padding: 3px 8px;
            color: #232323;
            text-decoration: none;
            float: left;
            font-size: 0.8em;
        }
        .slideShow ul.topNavigation {
            margin: 0px 0px 40px 0px;
        }
        .slideShow .navigation a:hover, .slideShow .navigation a.selected {
            background-color: #929292;
            color: #000000;
        }
        
        /** slides with more than an image in it **/
        .slide img {
            position: absolute;
        }
        .slide h1 {
            position: absolute;
            background-color: #ffffff;
            left: 0px;
            top: 0px;
        }
        
        /** slideshow with images in navigation **/
        .navigation.white a, .navigation.white li {
            background-color: #ffffff;
        }
        .navigation.white a {
            border: 1px solid #ffffff;
            padding: 0px;
            line-height: 0.8em;
        }
        .navigation.white a:hover, .navigation.white a.selected {
            background-color: #ffffff;
            border: 1px solid #999;
        }
        
        </style>

Code:
<!-- First Slideshow -->
                    <div class="simpleSlideShow slideShow">
                    <ul class="slides">
                        <li class="slide"><img src="index-Dateien/dg.jpg" border="0" alt="" /></li>
                        <li class="slide"><img src="index-Dateien/dg2.jpg" border="0" alt="" /></li>
                
                    </ul>
                </div>

Code:
<!-- Javascripts needed for jquery.slideShow -->
                <script type="text/javascript" src="jquery.js"></script>
                
                <!-- jquery.Slideshow file -->
                <script type="text/javascript" src="jquery.slideshow.js"></script>
                
                <!-- Javascripts for examples, can be deleted -->
                <script type="text/javascript">
                    $(document).ready(function() {
                        // simplest example
                        $('.simpleSlideShow, .slideShowTopNavi').slideShow({
                            interval: 3
                        });
                        // slideshow with mouse hover
                        $('.useMouseSlideShow').slideShow({
                            hoverNavigation: true,
                            interval: false,
                        });
                        // slideshow with images
                        $('.imageNavigation').slideShow({
                            interval: 3
                        });
                        // random slideshow
                        $('.randomSlideShow').slideShow({
                            interval: 3,
                            start: 'random'
                        });
                        
                        // slideshow with play/pause
                        var slideShow = $('.playPauseExample').slideShow({
                            interval: 0.7
                        });
                        // now add logic to play/pause button
                        $('.playPauseExample a.togglePlayback').click(function() {
                            if (slideShow.isPlaying()) {
                                $(this).html('play');
                            } else {
                                $(this).html('stop');
                            }
                            slideShow.togglePlayback();
                        });
                        
                        // slideshow with callback
                        $('.callbackSlideShow').slideShow({
                            interval: 3,
                            slideClick: function(slideShow) {
                                if (slideShow.mouse.x > slideShow.options.slideSize.width / 2) {
                                    slideShow.next();
                                } else {
                                    slideShow.previous();
                                }
                            },
                            gotoSlide: function(slideShow, index) {
                                $('.callBackSlideShowLog').html('goto slide index: ' + index);
                            }
                        });
                    });
                </script>

...und mehr is es in dem Original-Script ja nicht, deswegen check ich einfach nicht, wo der fehler sein kann? Ich hab ja auch keine doppelten Scripte oder irgendwas?!
 

sokie

Mod | Web

AW: Slider slidet einfach nicht. - HILFE

$('.useMouseSlideShow').slideShow({
hoverNavigation: true,
interval: false,
});
da hast du auch so ein überzähliges komma.
wie gesagt, die Beispiele erst einmal aus dem script löschen, und nur das notieren, was du wirklich brauchst. Sollte vielleicht schon ausreichen.
 

Foos

Member

AW: Slider slidet einfach nicht. - HILFE

hm ok.
hab jetzt alles rausgenommen und nur noch das hier stehen:

Code:
<!-- Javascripts needed for jquery.slideShow -->
                <script type="text/javascript" src="jquery.js"></script>
                
                <!-- jquery.Slideshow file -->
                <script type="text/javascript" src="jquery.slideshow.js"></script>
                
                <!-- Javascripts for examples, can be deleted -->
                <script type="text/javascript">
                    $(document).ready(function() {
                        // simplest example
                        $('.simpleSlideShow, .slideShowTopNavi').slideShow({
                            interval: 3
                        });
                    
                    });
                </script>


So richtig? (sliden tut noch nichts :) )
 

Duddle

Posting-Frequenz: 14µHz

AW: Slider slidet einfach nicht. - HILFE

Wenn du den Fehler rausnehmen würdest, den ich zuerst beschrieben habe, würde auch die slideShow()-Funktion richtig lad- und ausführbar sein.


Duddle
 

sokie

Mod | Web

AW: Slider slidet einfach nicht. - HILFE

Code:
 $('.simpleSlideShow, .slideShowTopNavi').slideShow({
In deiner Seite gibt es kein element mit der klasse "slideShowTopNavi".
 

Foos

Member

AW: Slider slidet einfach nicht. - HILFE

Hm ja das hab ich nun rausgenommen. Ändert aber wieder nichts..

<script type="text/javascript" src="jquery.js"></script>

<!-- jquery.Slideshow file -->
<script type="text/javascript" src="jquery.slideshow.js"></script>

<!-- Javascripts for examples, can be deleted -->
<script type="text/javascript">
$(document).ready(function() {
// simplest example
$('.simpleSlideShow').slideShow({
interval: 3
});

});
</script>

Das gibts doch nich.... ?
 

Foos

Member

AW: Slider slidet einfach nicht. - HILFE

Was mich so verwundert, ist das auf meiner heruntergeladenen Seite, also dem Original-Script folgender Code ist, welchen ich genauso kopiert habe. Pfad usw. stimmen ja. Und der Original Code funktioniert einwandfrei:

Code:
    <!-- First Slideshow -->
                <div class="simpleSlideShow slideShow">
                    <ul class="slides">
                        <li class="slide"><img src="img/1.jpg" border="0" alt="" /></li>
                        <li class="slide"><img src="img/2.jpg" border="0" alt="" /></li>
                        <li class="slide"><img src="img/3.jpg" border="0" alt="" /></li>
                        <li class="slide"><img src="img/4.jpg" border="0" alt="" /></li>
                        <li class="slide"><img src="img/5.jpg" border="0" alt="" /></li>
                        <li class="slide"><img src="img/6.jpg" border="0" alt="" /></li>
                        <li class="slide"><img src="img/7.jpg" border="0" alt="" /></li>
                    </ul>
                </div>
                
                
                
                <!-- Javascripts needed for jquery.slideShow -->
                <script type="text/javascript" src="jquery.js"></script>
                
                <!-- jquery.Slideshow file -->
                <script type="text/javascript" src="jquery.slideshow.js"></script>
                
                <!-- Javascripts for examples, can be deleted -->
                <script type="text/javascript">
                    $(document).ready(function() {
                        // simplest example
                        $('.simpleSlideShow, .slideShowTopNavi').slideShow({
                            interval: 3,
                        });
                
                    });
                </script>
 

Duddle

Posting-Frequenz: 14µHz

AW: Slider slidet einfach nicht. - HILFE

Hihi, ich fühle mich gerade wie beim CSI.

Folgendes: das Original-Script gibt als Encoding UTF-8 an, darum siehst du wenn du die Datei im Editor öffnest wohl auch keinen Fehler. Schaust du dir die Datei mal mit ISO-8859-2 an (und so hat es auch mein Firefox versucht zu interpretieren), dann ist an der Stelle ein Sonderzeichen sichtbar.

Das heisst, offenbar hat der Original-Author da einen Fehler mitgespeichert, und bisher hat ihn noch keiner bemerkt weil jeder das Ding als UTF-8 benutzt. Jedenfalls funktioniert bei mir deine Website/die Slideshow super, wenn ich Firefox auf UTF-8 stelle.


Ich habe mal eben die entsprechenden Zeichen rausgelöscht und jetzt sollte folgender Code sauber sein:
Code:
/**
 *	jquery.slideShow (1.0.5)
 * 	by Marcel Eichner (www.marceleichner.de)
 * 	<love@ephigenia.de>
 *
 *	This simple slideshow plugin will provide your effect gallery with
 * 	some simple features:
 *
 *	- auto slideshow with repeat and a lot of options
 *	- callback for slide changing (gotoSlide) and slide Clicks (onSlideClick)
 *	- different option variables to configure
 *	- change of slide through clicking numbers, next, prev etc and mouse
 *	  movement over the slides
 *	- text over images possible
 *	- random start slide via { start: 'rnd' }
 *	- start/stop slideshow and read playing status
 *	
 *	learn more about this plugin and other projects at:
 *	http://code.marceleichner.de/project/jquery.slideShow/
 *
 *	Copyright (c) 2009 Marcel Eichner (www.marceleichner.de)
 *	Licensed under the MIT license:
 *	http://www.opensource.org/licenses/mit-license.php
 *
 *	NOTE: This script requires jQuery to work.  Download jQuery at www.jquery.com
 */
(function($){
	
	$.fn.slideShow = function(options) {
		
		// multiple elements
		if (this.length > 1) {
			this.each(function() { $(this).slideShow(options)});
			return this;
		}

		// private vars
		this.defaults = {
			start: 			0,		// start index, set to 'random' or 'rnd' to random start
			interval: 		3,		// interval, autoplay, set to false for no auto-play, in seconds
			repeat: 		true,	// repeat at the end
			transition: {
				mode: 'fade',
				speed: 1000
			},
			slideSize: 		'auto',	// size for slides (used for mouseover and stuff)
			hoverNavigation:false,	// enable mouse to change images 
			slideClick: 	false,	// insert callback method for slide clicks
			gotoSlide: 		false	// slide change callback
		};
		this.options = $.extend({}, this.defaults, options);
		
		// internal vars
		this.numSlides = this.find('.slide').length;
		if (this.options.start == 'random' || this.options.start == 'rnd') {
			this.current = Math.floor(Math.random() * this.numSlides) + 1;
		} else {
			this.current = this.options.start;
		}
		if (this.current >= this.numSlides) {
			this.current = this.numSlides - 1;
		}
		this.last = false;
		this.elm = $(this);
		this.interval = false;
		this.mouse = {
			x: 0,		// store mouse x relative position on element
			y: 0,		// store mouse y relative position on element
			over: false	// store mouse over boolena value
		};
		
		// init slideshow
		this.init = function() {
			
			// set slide container to correct width and height
			if (this.find('.slides').length) {
				// auto-detect slide size
				if (this.options.slideSize == 'auto') {
					this.options.slideSize = {
						width: this.find('.slide:first img').width(),
						height: this.find('.slide:first img').height()
					};
				}
				// don't set size of slides and slide container if not needed
				if (this.options.slideSize != 'none' && this.options.slideSize != false) {
					this.find('.slides, .slide').css({
						height: this.options.slideSize.height + 'px',
						width: this.options.slideSize.width + 'px',
						overflow: 'hidden'
					});
				}
			}
			
			// set slides to be positioned absolute
			this.find('.slide').css('position','absolute');
			// hide slides if not hidden allready
			this.find('.slide:not(:eq(' + this.current + '))').hide();
			
			// navigation shortcuts
			this.find('.first, .next, .prev, .last, .navigation, .slide, .page, .slides').data('slideShow', this);
			this.find('.first').click(this.first);
			this.find('.next').click(this.next);
			this.find('.prev').click(this.previous);
			this.find('.last').click(this.last);
			
			this.find('.navigation .page:eq(' + this.current + ')').addClass('selected');
			this.find('.page').click(function() {
				if (!(slideShow = $(this).data('slideShow'))) {
					var slideShow = this;
				}
				// determine position in navigation
				var index = $(this).html();
				if (!(index = parseInt($(this).html()))) {
					var index = $(this).parents('.navigation').find('.page').index($(this));
				}
				slideShow.gotoSlide(index);
			});
			
			// init mouse move handler
			this.find('.slide').mousemove(function(event) {
				var slideShow = $(this).data('slideShow');
				// calculate mouse relative position and store it
				slideShow.mouse.x = Math.abs(event.clientX - $(this).position().left);
				slideShow.mouse.y = Math.abs(event.clientY - $(this).position().top);
				if (slideShow.mouse.x > slideShow.options.slideSize.width) slideShow.mouse.x = slideShow.options.slideSize.width;
				if (slideShow.mouse.y > slideShow.options.slideSize.height) slideShow.mouse.y = slideShow.options.slideSize.height;
				// use mouse vor navigation, calculate new page from mouse position
				if (slideShow.options.hoverNavigation) {
					var index = Math.round((slideShow.numSlides - 1) * slideShow.mouse.x / slideShow.options.slideSize.width);
					slideShow.gotoSlide(index, true);
				}	
			});
			
			// mouse enter handler
			this.find('.slide').mouseenter(function() {
				var slideShow = $(this).data('slideShow');
				slideShow.mouse.over = true;
				slideShow.stopAuto();
			});
			
			// mouse leave handler
			this.find('.slide').mouseleave(function() {
				var slideShow = $(this).data('slideShow');
				slideShow.mouse.over = false;
				slideShow.auto();
			});
			
			// on click handler
			if (typeof(this.options.slideClick) == 'function') {
				this.find('.slide').click(function() {
					var slideShow = $(this).data('slideShow');
					slideShow.options.slideClick(slideShow);
				});
			}

			g = this.current;
			this.current = -1;
			this.gotoSlide(g);
			// start interval for auto animation
			if (this.options.interval > 0) {
				this.auto();
			}
			return this;
		};
		
		// public methods
		this.auto = function() {
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			if (!slideShow.interval && slideShow.options.interval > 0.001) {
				slideShow.interval = window.setInterval(function() {
					slideShow.next();
				}, slideShow.options.interval * 1000);
			}
			return this;
		}
		// check if slideshow is running
		this.isPlaying = function() {
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			return slideShow.interval;
		}
		// stop/play slideshow automatic 
		this.togglePlayback = function() {
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			if (slideShow.isPlaying()) {
				slideShow.stopAuto();
			} else {
				slideShow.auto();
			}
		},
		// stop automatic slideshow
		this.stopAuto = function() {
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			if (slideShow.interval) {
				window.clearInterval(slideShow.interval);
				slideShow.interval = false;
			}
			return this;
		}
		// goto first slide
		this.first = function(elm) {
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			return slideShow.gotoSlide(0);
		};
		// goto last slide
		this.next = function() {
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			return slideShow.gotoSlide(slideShow.current + 1);
		};
		this.previous = function() {
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			return slideShow.gotoSlide(slideShow.current - 1);
		};
		this.last = function() {
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			return slideShow.gotoSlide(slideShow.numSlides);
		};
		this.gotoSlide = function(index, noanimation) {			
			if (index < 0) {
				index = this.numSlides - 1;
			}
			if (index >= this.numSlides) {
				index = 0;
			}
			if (index === this.current) return this;
			// get slide elements
			var oldSlide = this.find('.slide:eq(' + this.current +')');
			var newSlide = this.find('.slide:eq(' + index +')');
			// callbacks for animation finished
			oldFinished = function () {
				$(this).removeClass('selected');
				if (!(slideShow = $(this).data('slideShow'))) {
					var slideShow = this;
				}
				slideShow.elm.find('.navigation .page:eq(' + slideShow.current + ')').addClass('selected');
				if (!slideShow.mouse.over) {
					slideShow.auto();
				}
			}
			newFinished = function() {
				if (!(slideShow = $(this).data('slideShow'))) {
					var slideShow = this;
				}
				slideShow.elm.find('.navigation .page:not(:eq(' + slideShow.current + '))').removeClass('selected');
				$(this).addClass('selected');
			}
			// get slideshow
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			slideShow.stopAuto();
			// call callback
			if (typeof(this.options.gotoSlide) == 'function') {
				this.options.gotoSlide(slideShow, index);
			}
			// start transition
			if (noanimation){
				oldSlide.hide(1, oldFinished);
				newSlide.show(1, newFinished);
			} else {
				if (typeof(this.options.transition.mode) == 'function') {
					this.call(this.options.transition.mode, newSlide, oldSlide);
				} else {
					switch(this.options.transition.mode) {
						default:
						case 'fade':
							oldSlide.fadeOut(this.options.transition.speed, oldFinished);
							newSlide.fadeIn(this.options.transition.speed, newFinished);
							break;
					}
				}
			}
			this.last = this.current;
			this.current = index;
			return this;
		};
		
		return this.init();
	}
	
})(jQuery);

Du kannst ja beide Scripte mal diffen, falls du mir nicht vertraust ;)

Ich werde auch mal dem Original-Author eine Mail schreiben.

Duddle
 

Foos

Member

AW: Slider slidet einfach nicht. - HILFE

YEAH - Dicken Respekt :)
Etz funktionierts!
---
Allerdings taucht gleich ein neues Problem auf :)
Komischerweise haut es jetzt mein Layout durcheinander.
Aber nur durch den neuen .js-Code!

Sobald mein Bild erscheint, liegt meine Linkleiste am unteren Bildschirmrand. :)

Ich bitte euch nocheinmal um Hilfe, da es ja an dem .JS Code liegt? :)

DANKE DANKE DANKE
 

Duddle

Posting-Frequenz: 14µHz

AW: Slider slidet einfach nicht. - HILFE

Mir fällt nur auf, dass es richtig aussieht, wenn ich im Firebug für body#home div#headerHome das margin:405px 0 0; auskommentiere (siehe main.css). Wenn du margin so angibst, will er nach oben und unten jeweils 405px Abstand einbauen, und der erscheint dann eben als Lücke.
Welche CSS-Eigenschaften die Slideshow manipuliert, kannst du im übrigen auch gut im Firebug im HTML-Tab nachverfolgen.


Duddle
 

Foos

Member

AW: Slider slidet einfach nicht. - HILFE

Also am CSS liegt es irgendwie nicht.
Ich glaube der Fehler liegt irgendwo in dem neuen JS-Code. Weil mit dem alten war die Leiste noch an der richtigen Stelle und wenn ich den Code lösche ist sie auch wieder da...
Blickt da jemand durch:
Code:
/**
 *    jquery.slideShow (1.0.5)
 *     by Marcel Eichner (www.marceleichner.de)
 *     <love@ephigenia.de>
 *
 *    This simple slideshow plugin will provide your effect gallery with
 *     some simple features:
 *
 *    - auto slideshow with repeat and a lot of options
 *    - callback for slide changing (gotoSlide) and slide Clicks (onSlideClick)
 *    - different option variables to configure
 *    - change of slide through clicking numbers, next, prev etc and mouse
 *      movement over the slides
 *    - text over images possible
 *    - random start slide via { start: 'rnd' }
 *    - start/stop slideshow and read playing status
 *    
 *    learn more about this plugin and other projects at:
 *    http://code.marceleichner.de/project/jquery.slideShow/
 *
 *    Copyright (c) 2009 Marcel Eichner (www.marceleichner.de)
 *    Licensed under the MIT license:
 *    http://www.opensource.org/licenses/mit-license.php
 *
 *    NOTE: This script requires jQuery to work.  Download jQuery at www.jquery.com
 */
(function($){
    
    $.fn.slideShow = function(options) {
        
        // multiple elements
        if (this.length > 1) {
            this.each(function() { $(this).slideShow(options)});
            return this;
        }

        // private vars
        this.defaults = {
            start:             0,        // start index, set to 'random' or 'rnd' to random start
            interval:         3,        // interval, autoplay, set to false for no auto-play, in seconds
            repeat:         true,    // repeat at the end
            transition: {
                mode: 'fade',
                speed: 1000
            },
            slideSize:         'auto',    // size for slides (used for mouseover and stuff)
            hoverNavigation:false,    // enable mouse to change images 
            slideClick:     false,    // insert callback method for slide clicks
            gotoSlide:         false    // slide change callback
        };
        this.options = $.extend({}, this.defaults, options);
        
        // internal vars
        this.numSlides = this.find('.slide').length;
        if (this.options.start == 'random' || this.options.start == 'rnd') {
            this.current = Math.floor(Math.random() * this.numSlides) + 1;
        } else {
            this.current = this.options.start;
        }
        if (this.current >= this.numSlides) {
            this.current = this.numSlides - 1;
        }
        this.last = false;
        this.elm = $(this);
        this.interval = false;
        this.mouse = {
            x: 0,        // store mouse x relative position on element
            y: 0,        // store mouse y relative position on element
            over: false    // store mouse over boolena value
        };
        
        // init slideshow
        this.init = function() {
            
            // set slide container to correct width and height
            if (this.find('.slides').length) {
                // auto-detect slide size
                if (this.options.slideSize == 'auto') {
                    this.options.slideSize = {
                        width: this.find('.slide:first img').width(),
                        height: this.find('.slide:first img').height()
                    };
                }
                // don't set size of slides and slide container if not needed
                if (this.options.slideSize != 'none' && this.options.slideSize != false) {
                    this.find('.slides, .slide').css({
                        height: this.options.slideSize.height + 'px',
                        width: this.options.slideSize.width + 'px',
                        overflow: 'hidden'
                    });
                }
            }
            
            // set slides to be positioned absolute
            this.find('.slide').css('position','absolute');
            // hide slides if not hidden allready
            this.find('.slide:not(:eq(' + this.current + '))').hide();
            
            // navigation shortcuts
            this.find('.first, .next, .prev, .last, .navigation, .slide, .page, .slides').data('slideShow', this);
            this.find('.first').click(this.first);
            this.find('.next').click(this.next);
            this.find('.prev').click(this.previous);
            this.find('.last').click(this.last);
            
            this.find('.navigation .page:eq(' + this.current + ')').addClass('selected');
            this.find('.page').click(function() {
                if (!(slideShow = $(this).data('slideShow'))) {
                    var slideShow = this;
                }
                // determine position in navigation
                var index = $(this).html();
                if (!(index = parseInt($(this).html()))) {
                    var index = $(this).parents('.navigation').find('.page').index($(this));
                }
                slideShow.gotoSlide(index);
            });
            
            // init mouse move handler
            this.find('.slide').mousemove(function(event) {
                var slideShow = $(this).data('slideShow');
                // calculate mouse relative position and store it
                slideShow.mouse.x = Math.abs(event.clientX - $(this).position().left);
                slideShow.mouse.y = Math.abs(event.clientY - $(this).position().top);
                if (slideShow.mouse.x > slideShow.options.slideSize.width) slideShow.mouse.x = slideShow.options.slideSize.width;
                if (slideShow.mouse.y > slideShow.options.slideSize.height) slideShow.mouse.y = slideShow.options.slideSize.height;
                // use mouse vor navigation, calculate new page from mouse position
                if (slideShow.options.hoverNavigation) {
                    var index = Math.round((slideShow.numSlides - 1) * slideShow.mouse.x / slideShow.options.slideSize.width);
                    slideShow.gotoSlide(index, true);
                }    
            });
            
            // mouse enter handler
            this.find('.slide').mouseenter(function() {
                var slideShow = $(this).data('slideShow');
                slideShow.mouse.over = true;
                slideShow.stopAuto();
            });
            
            // mouse leave handler
            this.find('.slide').mouseleave(function() {
                var slideShow = $(this).data('slideShow');
                slideShow.mouse.over = false;
                slideShow.auto();
            });
            
            // on click handler
            if (typeof(this.options.slideClick) == 'function') {
                this.find('.slide').click(function() {
                    var slideShow = $(this).data('slideShow');
                    slideShow.options.slideClick(slideShow);
                });
            }

            g = this.current;
            this.current = -1;
            this.gotoSlide(g);
            // start interval for auto animation
            if (this.options.interval > 0) {
                this.auto();
            }
            return this;
        };
        
        // public methods
        this.auto = function() {
            if (!(slideShow = $(this).data('slideShow'))) {
                var slideShow = this;
            }
            if (!slideShow.interval && slideShow.options.interval > 0.001) {
                slideShow.interval = window.setInterval(function() {
                    slideShow.next();
                }, slideShow.options.interval * 1000);
            }
            return this;
        }
        // check if slideshow is running
        this.isPlaying = function() {
            if (!(slideShow = $(this).data('slideShow'))) {
                var slideShow = this;
            }
            return slideShow.interval;
        }
        // stop/play slideshow automatic 
        this.togglePlayback = function() {
            if (!(slideShow = $(this).data('slideShow'))) {
                var slideShow = this;
            }
            if (slideShow.isPlaying()) {
                slideShow.stopAuto();
            } else {
                slideShow.auto();
            }
        },
        // stop automatic slideshow
        this.stopAuto = function() {
            if (!(slideShow = $(this).data('slideShow'))) {
                var slideShow = this;
            }
            if (slideShow.interval) {
                window.clearInterval(slideShow.interval);
                slideShow.interval = false;
            }
            return this;
        }
        // goto first slide
        this.first = function(elm) {
            if (!(slideShow = $(this).data('slideShow'))) {
                var slideShow = this;
            }
            return slideShow.gotoSlide(0);
        };
        // goto last slide
        this.next = function() {
            if (!(slideShow = $(this).data('slideShow'))) {
                var slideShow = this;
            }
            return slideShow.gotoSlide(slideShow.current + 1);
        };
        this.previous = function() {
            if (!(slideShow = $(this).data('slideShow'))) {
                var slideShow = this;
            }
            return slideShow.gotoSlide(slideShow.current - 1);
        };
        this.last = function() {
            if (!(slideShow = $(this).data('slideShow'))) {
                var slideShow = this;
            }
            return slideShow.gotoSlide(slideShow.numSlides);
        };
        this.gotoSlide = function(index, noanimation) {            
            if (index < 0) {
                index = this.numSlides - 1;
            }
            if (index >= this.numSlides) {
                index = 0;
            }
            if (index === this.current) return this;
            // get slide elements
            var oldSlide = this.find('.slide:eq(' + this.current +')');
            var newSlide = this.find('.slide:eq(' + index +')');
            // callbacks for animation finished
            oldFinished = function () {
                $(this).removeClass('selected');
                if (!(slideShow = $(this).data('slideShow'))) {
                    var slideShow = this;
                }
                slideShow.elm.find('.navigation .page:eq(' + slideShow.current + ')').addClass('selected');
                if (!slideShow.mouse.over) {
                    slideShow.auto();
                }
            }
            newFinished = function() {
                if (!(slideShow = $(this).data('slideShow'))) {
                    var slideShow = this;
                }
                slideShow.elm.find('.navigation .page:not(:eq(' + slideShow.current + '))').removeClass('selected');
                $(this).addClass('selected');
            }
            // get slideshow
            if (!(slideShow = $(this).data('slideShow'))) {
                var slideShow = this;
            }
            slideShow.stopAuto();
            // call callback
            if (typeof(this.options.gotoSlide) == 'function') {
                this.options.gotoSlide(slideShow, index);
            }
            // start transition
            if (noanimation){
                oldSlide.hide(1, oldFinished);
                newSlide.show(1, newFinished);
            } else {
                if (typeof(this.options.transition.mode) == 'function') {
                    this.call(this.options.transition.mode, newSlide, oldSlide);
                } else {
                    switch(this.options.transition.mode) {
                        default:
                        case 'fade':
                            oldSlide.fadeOut(this.options.transition.speed, oldFinished);
                            newSlide.fadeIn(this.options.transition.speed, newFinished);
                            break;
                    }
                }
            }
            this.last = this.current;
            this.current = index;
            return this;
        };
        
        return this.init();
    }
    
})(jQuery);
 

Duddle

Posting-Frequenz: 14µHz

AW: Slider slidet einfach nicht. - HILFE

Wie gesagt, du darfst ruhig beide Versionen diffen, dann siehst du das ich nix im Code geändert habe.

Der Unterschied ist aber, dass das JS vorher nicht ausgeführt wurde, deshalb wurde nichts im HTML geändert, deshalb sah es korrekt aus. Die Slideshow ändert aber offensichtlich etwas am DOM, und in den CSS-Anweisungen der beteiligten Elemente, deshalb musste du dein CSS für die gesamte Seite anpassen. Ich habe ja selbst gesehen, dass die Seite wieder korrekt aussieht, wenn ich die angemerkte CSS-Anweisung entferne.


Duddle
 

Foos

Member

AW: Slider slidet einfach nicht. - HILFE

achsoooo ok!

Aber wenn ich den Margin entferne oder so ändere, wie du es geschrieben hat, geht es trotzdem nicht?
 
Zuletzt bearbeitet:
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

Neueste Themen & Antworten

Flatrate für Tutorials, Assets, Vorlagen

Zurzeit aktive Besucher

Statistik des Forums

Themen
175.189
Beiträge
2.582.077
Mitglieder
67.259
Neuestes Mitglied
SaschMasch1312
Oben