|
|||
Skripte je nach Browser laden
Hallo Leute
ich bin gerade dabei eine Internetseite mit einer Bildergalerie (mit der lightbox photoswipe) zu erstellen, aber da habe ich gerade ein paar Probleme. PHOTOSWIPE gibt es in zwei Varianten bzw. das Skript dazu. 1. für das Skript ist keine weitere Bibliothek (wie zum Beispiel jquery) erforderlich und ist für Webkit und Mozilla Browser gedacht. 2. für den Internet Explorer gibt es ein anderes Skript, das auf der Bibliothek jquery aufgebaut ist und diese benötigt. Dazu hier die Informationen des Entwicklers: Getting Started PhotoSwipe comes with an example site to help you get started. There are two distributions of the library: The default distribution optimised for WebKit and Mozilla based browsers. This distribution uses standard DOM querying and manipulation. It also uses CSS3 transformations for animations. The jQuery distribution that uses jQuery as it's engine. It is recommended for WebKit based mobile devices to use the default distribution. This negates a lot of the overhead from using jQuery. It does not require jQuery (so one less library to download to your mobile device!). The default distribution will also work on desktop WebKit browsers (such as Chrome and Safari) as well as Firefox 4 and above. Use the jQuery distibution if you need to support a wider range of browsers such as Internet Explorer etc. Getting Started - Default Distribution PhotoSwipe This example assumes no jQuery at all and is heavily optimised for WebKit and Mozilla browsers. PhotoSwipe.attach takes three parameters, an array of HTML elements, optional options and optional instance ID string. // Set up PhotoSwipe with all anchor tags in the Gallery container Code:
document.addEventListener('DOMContentLoaded', function(){ var myPhotoSwipe = PhotoSwipe.attach( window.document.querySelectorAll('#Gallery a'), { enableMouseWheel: false , enableKeyboard: false } ); }, false); PhotoSwipe The plugin takes two parameters both of which optional; an options objectand an instance ID string. // Set up PhotoSwipe with all anchor tags in the Gallery container Code:
$(document).ready(function(){ var myPhotoSwipe = $("#Gallery a").photoSwipe({ enableMouseWheel: false , enableKeyboard: false }); }); Ich möchte es nun so haben, dass die Skripte der zweiten Variante geladen werden, wenn man die Seite mit einem Internet Explorer aufruft und bei einem anderen Browser sollen die Skripte der ersten Variante geladen werden. Dazu habe ich folgendes Beispiel erstellt, das aber nur im Internet Explorer (getestet habe ich die Version 9) funktioniert, in anderen Browsern aber nicht. next cup was muss ich denn tun, damit die Skripte der ersten Variante für alle Browser außer den Internet Explorer geladen werden? und hier gibt es alles als Download: http://www.erdbeertorte.lima-city.de/next-cup.zip Geändert von Erdbeertorte (26.01.2013 um 14:51 Uhr) |
Sponsored Links |
|
|||
Zitat:
|
|
|||
Zitat:
|
|
|||
Alles klar! Danke für deine Erläuterungen. Und danke für das Testen. Internet Explorer 9 funktioniert die Galerie. Ich würde noch gerne wissen, ob diese Bildergalerie auch im Opera funktioniert. Sie müsste zwar eigentlich schon, aber sicher weiß ich das eben nicht.
|
|
||||
Zitat:
|
|
|
Ähnliche Themen | ||||
Thema | Autor | Forum | Antworten | Letzter Beitrag |
Skripte via .htaccess laden: php_value auto_prepend_file | AndreasB | Serveradministration und serverseitige Scripte | 6 | 03.12.2011 12:30 |
Erstellung einer Webseite - Support alter Browser ja oder nein? | Elektroniker | (X)HTML | 5 | 09.10.2011 18:11 |
Browser an Link anhängen | rs-web | Serveradministration und serverseitige Scripte | 1 | 26.03.2010 17:24 |
Bildergalerie: Erstes Bild beim Laden der Seite sichtbar | Angares | CSS | 1 | 02.02.2007 16:32 |
Problem mit Schriftgröße in Tabellen | pospiech | Knowledge Base | 20 | 10.08.2005 23:12 |