1jQuery(function($){ 2 3 // mobile toggle 4 $('#header .mobile_toggle span').click(function() { 5 $('.main-navigation').slideToggle('fast'); 6 }); 7 8 // home 9 if ($('#home .exhibits .image').length) { 10 var $image = $('#home .exhibits .image'); 11 $('#home .exhibits .nav a').hover(function() { 12 $image.attr('src', $(this).data('image-src')); 13 }); 14 } 15 if ($('#home .digital_exhibits .image').length) { 16 var $digital_image = $('#home .digital_exhibits .image'); 17 $('#home .digital_exhibits .nav a').hover(function() { 18 $digital_image.attr('src', $(this).data('image-src')); 19 }); 20 } 21 22 // page blocks: carousels 23 if ($('.page_blocks .carousel').length) { 24 $('.page_blocks .carousel').each(function() { 25 $(this).slick({ 26 infinite: true, 27 speed: 300, 28 slide: 'div', 29 slidesToShow: 1, 30 variableWidth: true, 31 prevArrow: '<span class="prev"></span>', 32 nextArrow: '<span class="next"></span>' 33 }); 34 }); 35 } 36 37 // page blocks: levels 38 if ($('.page_blocks .levels').length) { 39 $('.page_blocks .levels .box').click(function() { 40 $('.page_blocks .levels .box').removeClass('active'); 41 $(this).toggleClass('active'); 42 var $level = $(this).attr('rel'); 43 var $scrollto = $(this).data('scrollto'); 44 $('.page_blocks .level_info .level').hide(0); 45 $('.page_blocks .level_info .level.' + $level).slideToggle('fast'); 46 $('html, body').animate({scrollTop: $($scrollto).offset().top}, 600); 47 }); 48 $('.page_blocks .level_info .level .close').click(function() { 49 $('.page_blocks .levels .box').removeClass('active'); 50 $('.page_blocks .level_info .level').slideUp('fast'); 51 }); 52 } 53 54 // page blocks: toggle blocks 55 if ($('.page_blocks .toggle_block').length) { 56 $('.page_blocks .toggle_block a.toggle').click(function(e) { 57 e.preventDefault(); 58 $(this).toggleClass('active'); 59 $(this).parent().parent().find('.more').slideToggle(); 60 }); 61 } 62 63 64 65 // about: toggle details 66 if ($('#about .row .person h4.toggle').length) { 67 $('#about .row .person h4.toggle').click(function() { 68 $('#about .detail').hide(0); 69 var $person = $(this).attr('rel'); 70 var $group = $(this).parentsUntil('.group'); 71 $group.next('.details').find('.detail.' + $person).slideDown('fast', function() { 72 $top = $group.next('.details').find('.detail.' + $person).offset().top; 73 $('html, body').animate({scrollTop: $top}, 600); 74 }); 75 }); 76 $('#about .details .detail .close').click(function() { 77 $(this).parentsUntil('.group').find('.detail').slideUp('fast'); 78 }); 79 } 80 81 // news: load more events 82 $('#news .events .more a').click(function(e) { 83 e.preventDefault(); 84 if ($('#news .events .event.hidden').length <= 2) { 85 $(this).hide(0); 86 } 87 $('#news .events .event.hidden:lt(2)').show(0).removeClass('hidden'); 88 }); 89 90 // news: load more press 91 $('#news .press .more a').click(function(e) { 92 e.preventDefault(); 93 if ($('#news .press .cols.hidden').length == 1) { 94 $(this).hide(0); 95 } 96 $('#news .press .cols.hidden:first').show(0).removeClass('hidden'); 97 }); 98 99 // newsletter signup 100 if ($('.newsletter_signup').length) { 101 $.validator.addMethod('defaultInvalid', function(value, element) { 102 switch (element.value) { 103 case 'First Name': 104 if (element.name == 'fname') return false; 105 break; 106 case 'Last Name': 107 if (element.name == 'lname') return false; 108 break; 109 case 'Your Email Address': 110 if (element.name == 'cemail') return false; 111 break; 112 default: return true; 113 break; 114 } 115 },$.validator.messages.required); 116 $('.newsletter_signup').each(function() { 117 var $this = $(this); 118 $this.validate({ 119 debug: false, 120 rules: { 121 cemail: { 122 required: true, 123 email: true, 124 defaultInvalid: true 125 }, 126 fname: { 127 required: true, 128 defaultInvalid: true 129 }, 130 lname: { 131 required: true, 132 defaultInvalid: true 133 } 134 }, 135 submitHandler: function(form) { 136 $this.parent('.formwrap').find('.response').css('margin-top','10px').html('Working...'); 137 $.post(ajax_dir + 'newsletter-submit.php', $(form).serialize(), function(data) { 138 $this.parent('.formwrap').find('.response').html(''); 139 $this.html(data).fadeIn(300); 140 }); 141 } 142 }); 143 }); 144 } 145 146});
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.