1/** 2 * @file 3 * Mobile_navigation Library functionality. 4 * 5 * Author - Christian Galicia 6 * Licenses: GPLv2 7 */ 8 9/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */ 10 11window.matchMedia || (window.matchMedia = function() { 12 "use strict"; 13 14 // For browsers that support matchMedium api such as IE 9 and webkit 15 var styleMedia = (window.styleMedia || window.media); 16 17 // For those that don't support matchMedium 18 if (!styleMedia) { 19 var style = document.createElement('style'), 20 script = document.getElementsByTagName('script')[0], 21 info = null; 22 23 style.type = 'text/css'; 24 style.id = 'matchmediajs-test'; 25 26 script.parentNode.insertBefore(style, script); 27 28 // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers 29 info = ('getComputedStyle' in window) && window.getComputedStyle(style) || style.currentStyle; 30 31 styleMedia = { 32 matchMedium: function(media) { 33 var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; 34 35 // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers 36 if (style.styleSheet) { 37 style.styleSheet.cssText = text; 38 } else { 39 style.textContent = text; 40 } 41 42 // Test if media query is true or false 43 return info.width === '1px'; 44 } 45 }; 46 } 47 48 return function(media) { 49 return { 50 matches: styleMedia.matchMedium(media || 'all'), 51 media: media || 'all' 52 }; 53 }; 54}()); 55 56 57(function($) { 58 // Check for iPad/Iphone/Andriod 59 var instances = {}; 60 61 // Default options 62 var defaults = { 63 breakpoint : "all and (min-width: 740px) and (min-device-width: 740px), (max-device-width: 800px) and (min-width: 740px) and (orientation:landscape)", 64 //"all and (max-width: 740px) and (max-device-width: 740px), (max-device-width: 800px) and (min-width: 740px) and (orientation:landscape)", 65 66 //menuSelector : "#superfish-1", 67 //"#megamenu-main-menu", 68 //"#main-menu", 69 70 mainPageSelector : "body", 71 72 menuPlugin : "slideMenu", 73 //"default", 74 //"accordion", 75 76 showEffect : "fixed_left", 77 //"expand_down", /* Expanded from the position where the menu collapsed button is */ 78 //"fixed_top", 79 //"fixed_right", 80 //"fixed_bottom", 81 //"drawer_left", 82 //"drawer_right", 83 //"drawer_top", 84 showItems : "all", 85 //"active_trail", 86 tabHandler : false, 87 88 menuWidth : "65", 89 90 specialClasses : true, 91 92 useMask : true, 93 94 menuLabel : "Menu" 95 }; 96 97 $(document).ready(function() { 98 $("body").prepend("<div id='debugInfo'></div>"); 99 $("#debugInfo").css({ 100 position : "fixed", 101 right : "50px", 102 top : "50px" 103 }); 104 }); 105 106 // Main Class 107 var mobile_menu = function(elem, options) { 108 var settings, current = "", width, height; 109 110 this.methods = { 111 112 /* destroy */ 113 destroy : function() { 114 115 }, 116 117 cloneMenu : function() { 118 119 switch (_this.settings.showEffect) { 120 case "expand_down": 121 $(_this.target).before("<div id='mobile-menu-wrapper'><div id='mobile-menu-inner'></div></div>"); 122 //_this.settings.useMask = false; 123 break; 124 125 case "fixed_top": 126 case "drawer_top": 127 case "fixed_left": 128 case "drawer_left": 129 case "fixed_right": 130 case "drawer_right": 131 case "fixed_bottom": 132 $("body").prepend("<div id='mobile-menu-wrapper'><div id='mobile-menu-inner'></div></div>"); 133 break; 134 135 } 136 137 var classes = ""; 138 switch (_this.settings.menuPlugin) { 139 case "basic": 140 classes = "mobile-menu-basic"; 141 break; 142 143 case "accordion": 144 classes = "mobile-menu-accordion"; 145 break; 146 147 case "slideMenu": 148 classes = "mobile-menu-slide"; 149 break; 150 151 } 152 153 // Cloning 154 $('#mobile-menu-inner').append("<ul id='mobile-menu' class='" + classes + "'>" + $(_this.target).html() + "</ul>"); 155 // Clearing up other plugins classes 156 $('#mobile-menu li, #mobile-menu ul, #mobile-menu a').attr({ 157 id : "", 158 style : "" 159 }).removeClass('active'); 160 // Adding item-with-ul to submenu items 161 $("#mobile-menu li").each(function() { 162 if ($(this).find("ul").length) { 163 $(this).addClass("item-with-ul"); 164 } 165 }); 166 167 $("#mobile-menu li.item-with-ul > *:first-child").each(function() { 168 if ($(this).get(0).tagName == "A") { 169 $(this).wrap("<div></div>"); 170 } 171 $(this).parent().addClass("submenu-title"); 172 }); 173 174 if (_this.settings.tabHandler) { 175 var show = true, dir_class = ""; 176 switch (_this.settings.showEffect) { 177 case "expand_down": 178 show = false;
179 break; 180 181 case "fixed_top": 182 case "drawer_top": 183 dir_class = "top"; 184 break; 185 186 case "fixed_left": 187 case "drawer_left": 188 dir_class = "left"; 189 break; 190 191 case "fixed_right": 192 case "drawer_right": 193 dir_class = "right"; 194 break; 195 196 case "fixed_bottom": 197 dir_class = "bottom"; 198 break; 199 200 } 201 if (show) { 202 $("#mobile-menu-inner").prepend("<a id='menu-attached-button' class='mobile-menu-button " + dir_class + "'>" + _this.settings.menuLabel + "</a>"); 203 $("#menu-attached-button").click(function(e) { 204 _this.menuToggle(this); 205 e.stopPropagation(); 206 e.preventDefault(); 207 }); 208 } 209 } 210 211 $('#mobile-menu-inner').hide(); 212 213 // Add special classes to menu. 214 if (_this.settings.specialClasses) { 215 function addClassesToUl(ul, parentClass) { 216 217 var ii = 1; 218 $(ul).find("> li").each(function() { 219 if (parentClass == "") { 220 var cls = "menuitem-" + ii; 221 } else { 222 var cls = "menuitem-" + parentClass + "-" + ii; 223 } 224 225 $(this).addClass(cls); 226 227 if ($(this).hasClass("item-with-ul")) { 228 229 if (parentClass == "") { 230 addClassesToUl($(this).find("> ul"), ii); 231 } else { 232 addClassesToUl($(this).find("> ul"), parentClass + "-" + ii); 233 } 234 235 } 236 ii++; 237 238 }); 239 240 } 241 242 addClassesToUl($("#mobile-menu"), ""); 243 } 244 245 }, 246 247 collapseInAButton : function() { 248 249 if (!$("#collapsed-menu-button").length) { 250 // Create button 251 if (_this.settings.showEffect == "expand_down") { 252 $("#mobile-menu-wrapper").before("<a id='collapsed-menu-button' class='mobile-menu-button'>" + _this.settings.menuLabel + "</a>"); 253 } else { 254 $(_this.target).before("<a id='collapsed-menu-button' class='mobile-menu-button'>" + _this.settings.menuLabel + "</a>"); 255 } 256 257 $("#mobile-menu-inner").hide(); 258/* 259 $("#collapsed-menu-button").unbind("click").click(function(e) { 260 _this.menuToggle(this); 261 e.stopPropagation(); 262 e.preventDefault(); 263 }); 264 */ 265 if ('ontouchstart' in document.documentElement) { 266 $('#collapsed-menu-button').on('touchstart', function(e) { 267 _this.menuToggle(this); 268 e.stopPropagation(); 269 e.preventDefault(); 270 }); 271 } else { 272 $("#collapsed-menu-button").unbind('click').click(function(e) { 273 _this.menuToggle(this); 274 e.stopPropagation(); 275 e.preventDefault(); 276 }); 277 } 278 } 279 }, 280 281 // Build Slide Menu plugin 282 slideMenuBuild : function() { 283 284 if (!$("#mobile-menu").length) { 285 _this.cloneMenu(); 286 $("#mobile-menu-inner").addClass("slidemenu"); 287 $("#mobile-menu .item-with-ul ul").hide(); 288 $("#mobile-menu").addClass("mobile-menu-slide").wrap("<div id='mobile-menu-display'></div>").wrap("<div id='slide-menu-clip'></div>"); 289 $("#mobile-menu-display").css({ 290 overflow : "hidden" 291 }); 292 $("#mobile-menu-inner").css({ 293 width : _this.settings.menuWidth + "%" 294 }); 295 296 function buildNewSub(sub) { 297 var no = $(".mobile-menu-slide").length, id = "mobile-menu-" + no, mm_w = $("#mobile-menu-inner").width(); 298 299 var ul = $($('<div></div>').html($(sub).clone())).html(); 300 301 $("#slide-menu-clip").append("<ul id='" + id + "' class='mobile-menu mobile-menu-slide'>" + ul + "</ul>"); 302 $("#" + id + " > li > ul").show(); 303 $("#" + id + " > li > *").first().addClass("return-link"); 304 $("#" + id + " > li > ul").css({ 305 padding : 0 306 }); 307 308 $("#slide-menu-clip").css({ 309 width : (mm_w * (no + 1)), 310 float : "left" 311 }); 312 $(".mobile-menu-slide").css({ 313 width : mm_w, 314 float : "left" 315 }); 316 317 $('#slide-menu-clip').animate({ 318 "marginLeft" : -(mm_w * no) 319 }, 'normal'); 320 321 //$("#"+id+" .item-with-ul").unbind('click'); 322 bindClick("#" + id); 323 324 $("#" + id + " .return-link").unbind('click').click(function(e) { 325 $('#slide-menu-clip').animate({ 326 "marginLeft" : -($("#mobile-menu-inner").width() * ($(".mobile-menu-slide").length - 2)) 327 }, 'normal', function() { 328 $(".mobile-menu-slide:last").remove(); 329 $("#slide-menu-clip").css({ 330 width : ($("#mobile-menu-inner").width() * ($(".mobile-menu-slide").length + 1)), 331 float : "left" 332 }); 333 }); 334 335 e.preventDefault(); 336 e.stopPropagation(); 337 }); 338 339 } 340 341 function bindClick(item) { 342 $(item).find(".item-with-ul").unbind('click').click(function(e) { 343 buildNewSub(this); 344 e.preventDefault(); 345 e.stopPropagation(); 346 }); 347 $(item).find("li a").unbind('click').click(function(e) { 348 e.stopPropagation(); 349 }); 350 } 351 352 bindClick("#mobile-menu"); 353 } 354 355 }, 356 357 accordionBuild : function() { 358 if (!$("#mobile-menu").length) { 359 //var menu = ; 360 _this.cloneMenu(); 361 $("#mobile-menu-inner").addClass("accordion").css({ 362 width : _this.settings.menuWidth + "%" 363 }); 364 $("#mobile-menu").width(_this.width); 365 // _this.settings.showItems possible values: all, active_trail 366 if (_this.settings.expandActive) { 367 $("#mobile-menu .item-with-ul:not(.active-trail) ul").hide(); 368 $("#mobile-menu .item-with-ul.active-trail").addClass("active"); 369 } else { 370 $("#mobile-menu .item-with-ul ul").hide(); 371 } 372 373 $("#mobile-menu .item-with-ul").unbind('click').click(function(e) { 374 if (_this.settings.showItems == "active_trail") { 375 $("#mobile-menu .item-with-ul ul").not($(this).find("ul")).not($(this).parents()).slideUp("fast"); 376 } 377 $(this).find("ul").first().slideToggle(function() { 378 $("#mobile-menu .item-with-ul").removeClass("active"); 379 $("#mobile-menu .item-with-ul ul").each(function() { 380 if ($(this).css("display") != "none") { 381 $(this).parent("li").addClass("active"); 382 } 383 }); 384 385 switch (_this.settings.showEffect) { 386 case "drawer_right": 387 $(_this.settings.mainPageSelector).css({ 388 overflow : "hidden", 389 height : $("#mobile-menu").height() 390 }); 391 break; 392 393 } 394 }); 395 396 e.stopPropagation(); 397 }); 398 $("#mobile-menu .item-with-ul a").unbind('click').click(function(e) { 399 e.stopPropagation(); 400 }); 401 } 402 }, 403 404 basicBuild : function() { 405 if (!$("#mobile-menu").length) { 406 _this.cloneMenu(); 407 } 408 }, 409 410 menuToggle : function(button) { 411 if ($(button).hasClass("active")) {/* If it's openned */ 412 if (_this.settings.menuPlugin == "accordion" && _this.settings.showItems == "active_trail") { 413 $("#mobile-menu .item-with-ul:not(.active-trail) ul").slideUp().parent("li").removeClass("active"); 414 } 415 416 if (_this.settings.useMask) { 417 $("#mobile-navigation-mask").fadeOut("slow"); 418 } 419 420 switch (_this.settings.showEffect) { 421 case "expand_down": 422 $("#mobile-menu-inner").slideUp("fast"); 423 break; 424 425 case "drawer_top": 426 $('#slide-menu-clip').animate({ 427 marginLeft : 0, 428 }, 'fast', function() { 429 $(".mobile-menu-slide").not("#mobile-menu").remove(); 430 431 }); 432 $("#mobile-menu-inner #mobile-menu").slideUp(); 433 434 break; 435 436 case "drawer_left": 437 $("#mobile-menu-inner").animate({ 438 left : "-" + _this.settings.menuWidth + "%" 439 }, "slow", function() { 440 // Animation complete. 441 }); 442 $(_this.settings.mainPageSelector).animate({ 443 left : "0" 444 }, "slow", function() { 445 // Animation complete. 446 $(this).css({ 447 overflow : "inherit", 448 height : "auto", 449 position : "relative", 450 width : "auto" 451 }) 452 }); 453 break; 454 455 case "drawer_right": 456 // cerrar 457 $("#mobile-menu-inner").animate({ 458 left : "100%" 459 }, "slow", function() { 460 // Animation complete. 461 $("#mobile-menu").css({ 462 display : "none", 463 width : 0 464 }); 465 $(this).css({ 466 width : 0 467 }); 468 }); 469 $(_this.settings.mainPageSelector).animate({ 470 left : "0" 471 }, "slow", function() { 472 // Animation complete. 473 $(this).css({ 474 overflow : "auto", 475 height : "auto" 476 }) 477 }); 478 479 $('#slide-menu-clip').animate({ 480 marginLeft : 0, 481 482 }, 'normal', function() { 483 $(".mobile-menu-slide").not("#mobile-menu").remove(); 484 }); 485 486 break; 487 488 case "fixed_top": 489 $("#mobile-menu-inner").animate({ 490 top : "-" + _this.height + "px" 491 }, "fast", function() { 492 // Animation complete. 493 }); 494 break; 495 496 case "fixed_left": 497 $("#mobile-menu-inner").animate({ 498 left : "-" + _this.settings.menuWidth + "%" 499 }, "fast", function() { 500 // Animation complete. 501 }); 502 break; 503 504 case "fixed_right": 505 $("#mobile-menu-inner").animate({ 506 right : "-" + _this.settings.menuWidth + "%" 507 }, "fast", function() { 508 // Animation complete. 509 }); 510 break; 511 512 case "fixed_bottom": 513 $("#mobile-menu-inner").animate({ 514 bottom : "-" + _this.height + "px" 515 }, "fast", function() { 516 // Animation complete. 517 }); 518 break; 519 520 } 521 $(".mobile-menu-button").removeClass("active"); 522 523 } else { 524 if (_this.settings.useMask) { 525 $("#mobile-navigation-mask").fadeIn("slow").addClass("active"); 526 } 527 528 switch (_this.settings.showEffect) { 529 case "expand_down": 530 $("#mobile-menu-inner").slideDown("fast"); 531 break; 532 533 case "drawer_top": 534 $("#mobile-menu-inner #mobile-menu").slideDown(); 535 break; 536 537 case "drawer_left": 538 $(_this.settings.mainPageSelector).css({ 539 overflow : "hidden", 540 height : $("#mobile-menu").height(), 541 position : "fixed", 542 width: "100%" 543 }).animate({ 544 left : _this.settings.menuWidth + "%", 545 }, "slow", function() { 546 }); 547 $("#mobile-menu-inner").animate({ 548 left : 0 549 }, "slow", function() { 550 // Animation complete. 551 }); 552 break; 553 554 case "drawer_right": 555 $("#mobile-menu").show().css({ 556 display : "block", 557 width : "100%" 558 }); 559 560 $("#mobile-menu-inner").css({ 561 width : _this.settings.menuWidth + "%" 562 }).animate({ 563 left : (100 - _this.settings.menuWidth) + "%" 564 }, "slow", function() { 565 // Animation complete. 566 }); 567 568 $('#slide-menu-clip').animate({ 569 width : $("#mobile-menu-inner").width() + "px" 570 }); 571 $(_this.settings.mainPageSelector).animate({ 572 left : "-" + _this.settings.menuWidth + "%" 573 }, "slow", function() { 574 // Animation complete. 575 $(this).css({ 576 overflow : "hidden", 577 height : $("#mobile-menu").height() 578 }); 579 }); 580 break; 581 582 case "fixed_top": 583 $("#mobile-menu-inner").animate({ 584 top : "0" 585 }, "fast", function() { 586 // Animation complete. 587 }); 588 break; 589 590 case "fixed_left": 591 $("#mobile-menu-inner").animate({ 592 left : "0" 593 }, "fast", function() { 594 // Animation complete. 595 }); 596 break; 597 598 case "fixed_right": 599 $("#mobile-menu-inner").animate({ 600 right : "0" 601 }, "fast", function() { 602 // Animation complete. 603 }); 604 break; 605 606 case "fixed_bottom": 607 $("#mobile-menu-inner").animate({ 608 bottom : "0" 609 }, "fast", function() { 610 // Animation complete. 611 }); 612 break; 613 614 } 615 616 $(".mobile-menu-button").addClass("active"); 617 } 618 }, 619 620 mobileSet : function() { 621 $(_this.target).hide(); 622 623 $("#mobile-menu-wrapper").show(); 624 $("#collapsed-menu-button").show(); 625 626 if ($("#collapsed-menu-button.active").length > 0) { 627 if (_this.settings.useMask) { 628 $("#mobile-navigation-mask").show(); 629 } 630 } else { 631 if (_this.settings.useMask) { 632 $("#mobile-navigation-mask").hide(); 633 } 634 } 635 636 switch (_this.settings.showEffect) { 637 case "expand_down": 638 //$("#mobile-menu.inner").css({width: "100%"}); 639 break; 640 641 case "drawer_right": 642 $("#mobile-menu").css({ 643 minHeight : $(window).height() + "px" 644 }); 645 if ($("#collapsed-menu-button.active").length > 0) { 646 $(_this.settings.mainPageSelector).css({ 647 left : "-" + _this.settings.menuWidth + "%" 648 }); 649 $("#mobile-menu-inner").css({ 650 width : _this.settings.menuWidth + "%" 651 }); 652 653 $(_this.settings.mainPageSelector).css({ 654 left : "-" + _this.settings.menuWidth + "%", 655 overflow : "hidden", 656 height : $("#mobile-menu").height() 657 }); 658 $("#mobile-menu-inner").css({ 659 left : (100 - _this.settings.menuWidth) + "%" 660 }); 661 662 /*if (_this.settings.useMask) { 663 $("#mobile-navigation-mask").show(); 664 }*/ 665 } else { 666 $("#mobile-menu-inner").css({ 667 width : 0 668 }); 669 $("#mobile-menu").css({ 670 display : "none", 671 width : 0 672 }); 673 /* 674 if (_this.settings.useMask) { 675 $("#mobile-navigation-mask").hide(); 676 }*/ 677 } 678 679 break; 680 681 case "drawer_left": 682 $("#mobile-menu").css({ 683 minHeight : $(window).height() + "px" 684 }); 685 if ($("#collapsed-menu-button.active").length > 0) { 686 $(_this.settings.mainPageSelector).css({ 687 left : _this.settings.menuWidth + "%", 688 width: "100%" 689 }); 690 $(_this.settings.mainPageSelector).css({ 691
691 position : "fixed" 692 }); 693 } 694 break; 695 696 case "drawer_top": 697 $(_this.settings.mainPageSelector).css({ 698 left : "0", 699 overflow : "visible", 700 height : "auto" 701 }); 702 703 $("#mobile-menu-wrapper").css({ 704 width : "100%", 705 float : "left" 706 }); 707 708 break; 709 710 case "fixed_top": 711 //$("#mobile-menu.inner").css({width: "100%"}); 712 break; 713 714 case "fixed_left": 715 if ($("#collapsed-menu-button.active").length > 0) { 716 $("#mobile-menu-inner").animate({ 717 left : "0" 718 }, "fast", function() { 719 // Animation complete. 720 }); 721 722 } else { 723 $("#mobile-menu-inner").css({ 724 left : "-" + _this.settings.menuWidth + "%" 725 }, "fast", function() { 726 // Animation complete. 727 }); 728 } 729 break; 730 731 case "fixed_right": 732 $("#mobile-menu-wrapper").show(); 733 break; 734 735 case "fixed_bottom": 736 $("#mobile-menu-wrapper").show(); 737 $("#mobile-menu-inner").css({ 738 width : _this.settings.menuWidth + "%" 739 }); 740 break; 741 742 } 743 744 switch (_this.settings.menuPlugin) { 745 case "slideMenu": 746 var no = $(".mobile-menu-slide").length, mm_w = $("#mobile-menu-inner").width(); 747 748 $("#slide-menu-clip").css({ 749 width : (mm_w * no) 750 }); 751 $(".mobile-menu-slide").css({ 752 width : mm_w 753 }); 754 755 $('#slide-menu-clip').css({ 756 "marginLeft" : -(mm_w * (no - 1)) 757 }, 'normal'); 758 759 break; 760 761 case "accordion": 762 break; 763 764 } 765 766 }, 767 768 mobileUnset : function() { 769 $("#mobile-menu-wrapper").hide(); 770 $("#collapsed-menu-button").hide(); 771 772 switch (_this.settings.showEffect) { 773 case "expand_down": 774 break; 775 776 case "drawer_right": 777 $(_this.settings.mainPageSelector).css({ 778 left : 0, 779 height : "auto", 780 overflow : "auto" 781 }); 782 break; 783 784 case "drawer_left": 785 $(_this.settings.mainPageSelector).css({ 786 left : 0, 787 position : "relative", 788 height : "auto", 789 width : "auto" 790 }); 791 break; 792 793 case "drawer_top": 794 case "fixed_top": 795 case "fixed_left": 796 case "fixed_right": 797 case "fixed_bottom": 798 break; 799 800 } 801 802 if (_this.settings.useMask) { 803 $("#mobile-navigation-mask").hide(); 804 } 805 806 $(_this.target).show(); 807 }, 808 809 // Verify if a query is valid for current browser width. 810 checkQuery : function(query) { 811 return window.matchMedia(query).matches; 812 }, // End of checkQuery 813 initialSet : function() { 814 var menu_width = _this.width = $("#mobile-menu-inner").outerWidth() + ($("#mobile-menu-inner").outerWidth() / 10), menu_height = _this.height = $("#mobile-menu-inner").outerHeight(); 815 816 if (_this.settings.useMask) { 817 //$(_this.settings.mainPageSelector). 818 $("#mobile-menu-wrapper").css({ 819 position : "relative" 820 }).after("<div id='mobile-navigation-mask'></div>"); 821 $("#mobile-navigation-mask").click(function() { 822 _this.menuToggle(this); 823 }).hide(); 824 } 825 826 switch (_this.settings.showEffect) { 827 case "expand_down": 828 break; 829 830 case "fixed_top": 831 $("#mobile-menu-inner").css({ 832 position : "absolute", 833 top : "-" + menu_height + "px", 834 left : "0", 835 display : "block" 836 }); 837 break; 838 839 case "drawer_top": 840 $("#mobile-menu-inner").css({ 841 position : "relative", 842 display : "block" 843 }); 844 $("#mobile-menu-inner #mobile-menu").slideUp(); 845 break; 846 847 case "fixed_left": 848 $("#mobile-menu-inner").css({ 849 position : "absolute", 850 left : "-" + _this.settings.menuWidth + "%", 851 top : "0", 852 display : "block" 853 }); 854 855 break; 856 857 case "fixed_right": 858 $("#mobile-menu-inner").css({ 859 position : "fixed", 860 right : "-" + _this.settings.menuWidth + "%", 861 top : "0", 862 display : "block" 863 }); 864 break; 865 866 case "drawer_left": 867 $("#mobile-menu-inner").css({ 868 position : "absolute", 869 left : "-" + _this.settings.menuWidth + "%", 870 top : "0", 871 display : "block" 872 }); 873 break; 874 875 case "drawer_right": 876 $("#mobile-menu-inner").css({ 877 position : "absolute", 878 left : "100%", 879 top : "0", 880 display : "block" 881 }); 882 $(_this.settings.mainPageSelector).css({ 883 position : "relative" 884 885 }); 886 887 break; 888 889 case "fixed_bottom": 890 $("#mobile-menu-inner").css({ 891 position : "fixed", 892 bottom : "-" + menu_height + "px", 893 left : "0", 894 display : "block" 895 }); 896 break; 897 } 898 }, 899 onResize : function() { 900 if (_this.checkQuery(_this.settings.breakpoint)) { 901 if (current != "normal") { 902 _this.mobileUnset(); 903 } 904 _this.current = "normal"; 905 906 } else { 907 if (current != "mobile" && !$("#mobile-menu").length) { 908 switch (_this.settings.menuPlugin) { 909 case "basic": 910 _this.basicBuild(); 911 break; 912 913 case "accordion": 914 _this.accordionBuild(); 915 break; 916 917 case "slideMenu": 918 _this.slideMenuBuild(); 919 break; 920 921 } 922 _this.collapseInAButton(); 923 _this.initialSet(); 924 } 925 _this.current = "mobile"; 926 _this.mobileSet(); 927 928 } 929 }, 930 931 // INIT 932 init : function(elem, opts) { 933 _this.target = elem; 934 935 // Merge Default options with the specified 936 _this.settings = $.extend(true, {}, defaults, opts); 937 _this.onResize(); 938 939 $(window).resize(_this.onResize); 940 } // end of init 941 }; 942 // end of methods 943 944 var _this = this.methods; 945 946 }; 947 // end of mobile_menu class 948 949 // $.FN 950 $.fn.mobile_menu = function(opts) { 951 var id = $(this).attr('id'); 952 953 if (!(!$.support.leadingWhitespace)) { 954 //Not IE7 nor IE8. 955 if (instances[id] === undefined) { 956 instances[id] = new mobile_menu(this, opts); 957 return instances[id].methods.init(this, opts); 958 } else if (instances[id]) { 959 return instances[id].methods; 960 } else { 961 return $(this); 962 } 963 } 964 }; 965 // end of $.fn.mapSvg 966 967})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.