Zwei javascripts kollidieren
Eingetragen von Bavramor (129)
am 16.06.2015 - 14:32 Uhr in
am 16.06.2015 - 14:32 Uhr in
Ich habe für mein Main Menu diese jquery.movilemenu.js geladen:
/**
* jQuery Mobile Menu
* Turn unordered list menu into dropdown select menu
* version 1.0(31-OCT-2011)
*
* Built on top of the jQuery library
* http://jquery.com
*
* Documentation
* main-menu
*/
(function($){
$.fn.mobileMenu = function(options) {
var defaults = {
defaultText: 'Navigate to...',
className: 'select-menu',
subMenuClass: 'sub-menu',
subMenuDash: '–'
},
settings = $.extend( defaults, options ),
el = $(this);
this.each(function(){
// ad class to submenu list
el.find('ul').addClass(settings.subMenuClass);
// Create base menu
$('<select />',{
'class' : settings.className
}).insertAfter( el );
// Create default option
$('<option />', {
"value" : '#',
"text" : settings.defaultText
}).appendTo( '.' + settings.className );
// Create select option from menu
el.find('a,.separator').each(function(){
var $this = $(this),
optText = $this.text(),
optSub = $this.parents( '.' + settings.subMenuClass ),
len = optSub.length,
dash;
// if menu has sub menu
if( $this.parents('ul').hasClass( settings.subMenuClass ) ) {
dash = Array( len+1 ).join( settings.subMenuDash );
optText = dash + optText;
}
if($this.is('span')){
// Now build menu and append it
$('<optgroup />', {
"label" : optText,
}).appendTo( '.' + settings.className );
}
else{
// Now build menu and append it
$('<option />', {
"value" : this.href,
"html" : optText,
"selected" : (this.href == window.location.href)
}).appendTo( '.' + settings.className );
}
}); // End el.find('a').each
// Change event on select element
$('.' + settings.className).change(function(){
var locations = $(this).val();
if( locations !== '#' ) {
window.location.href = $(this).val();
}
});
$('.select-menu').show();
});
return this;
};
})(jQuery);
jQuery(function(){
jQuery('#superfish-1').mobileMenu();
})
Diese funktioniert auch soweit ganz gut. Für das Menü wird ein responsive menu angezeigt.
Nun habe ich auf meiner Seite „Facebook embedded Posts“ in einem Block eingebunden, und versuche diesen Block nun mit einem JavaScript responsive zu machen. Dafür verwende ich folgendes Script: http://jsfiddle.net/brohde/GRcen/
Dieses Script funktioniert auch soweit gut, nur allerdings verschwindet immer meine Mobiles Menü, sobald ich das Script geladen habe.
Woran liegt das, wäre für jede Hilfe sehr dankbar.
Gruß Bavra
- Anmelden oder Registrieren um Kommentare zu schreiben
Neue Kommentare
vor 3 Tagen 5 Stunden
vor 3 Tagen 13 Stunden
vor 3 Tagen 17 Stunden
vor 3 Tagen 23 Stunden
vor 1 Woche 14 Stunden
vor 1 Woche 16 Stunden
vor 1 Woche 1 Tag
vor 2 Wochen 3 Tagen
vor 3 Wochen 5 Tagen
vor 4 Wochen 1 Tag