123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- (function($){
- //addclass
- function addclass() {
- $('.content > div:first-child').addClass('net');
- $('img:nth-child(2)').parent('p').addClass('slider');
- $(".slider img").wrap("<div></>")
- };
- //functionsscroll
- function scrollbar() {
- var $colum = $(".column:not('#recherche-artistique'), #recherche-artistique > div");
- $(window).on("load",function(){
- $colum.mCustomScrollbar({
- theme:"minimal",
- mouseWheelPixels: 200,
- scrollInertia: 1000,
- });
- });
- };
- function scrollW() {
- $('a[href^="#"]').on('click', function(evt){
- evt.preventDefault();
- var target = $(this).attr('href');
- var rclass = $('.net');
- $('.underline').removeClass('underline');
- $(this).parent().addClass('underline');
- $('.block').removeClass('block');
- $('.sous-menu .underline').parent().addClass('block');
- $(rclass).removeClass('net');
- $(target).addClass('net');
- $(' html, body')
- .stop()
- .animate({
- scrollLeft: $(target).offset().left - ( $('section > div').width() - $('section > div').outerWidth() + $('header').outerWidth() ) },1000, );
- });
- };
- //mediaquieries
- function scrollTop(){
- $('a[href^="#"]').on('click', function(evt){
- evt.preventDefault();
- var target = $(this).attr('href');
- var rclass = $('.net');
- $('.underline').removeClass('underline');
- $(this).parent().addClass('underline');
- $('.block').removeClass('block');
- $('.sous-menu .underline').parent().addClass('block');
- $(rclass).removeClass('net');
- $(target).addClass('net');
- $('html,body').animate({
- scrollTop: $(target).offset().top - $('header').outerHeight()},'slow');
- });
- }
- function clickd() {
- var $rclass = $('.net');
- $('.content > div:not(#recherche-artistique), #recherche-artistique > div ').on('click', function(e) {
- $rclass.removeClass('net');
- $(this).addClass('net');
- $(' html, body').stop().animate({
- scrollLeft: $(this).offset().left - ( $('section > div').width() - $('section > div').outerWidth() + $('header').outerWidth() ) },1000);
- });
- };
- function gallery() {
- $('.slider').bxSlider({
- mode: 'horizontal',
- captions: true,
- adaptiveHeight:true,
- slideWidth: 600,
- touchEnabled: true,
- responsive:true,
- preloadImages: 'visible',
- touchEnabled: false,
- pager: false,
- });
- };
- function Openfp() {
- var $divgal = $( "<div id='gallery'></div>");
- var $button = $( "<button class=button></button>");
- var $img = $("section img")
- $img.each(function(index) {
- $(this).on("click", function() {
- $('body').prepend( $divgal );
- $(this).clone().appendTo('#gallery');
- $('#gallery').fadeIn(400).prepend( $button );
- $('#gallery > img').wrap('<div class=content-img style=opacity:1></div>');
- $( '#gallery' ).click(function(e) {
- $(' #gallery, #gallery > .content-img').fadeOut(400, function() {
- $(this).remove();
- });
- });
- });
- });
- };
- function liclick() {
- var $ulf = $('section #recherche-artistique #commentaire-philosophe ul > li > p')
- var $olf = $('section #recherche-artistique #commentaire-philosophe ul > li > ol > li')
- var $mark = $('section #recherche-artistique #commentaire-philosophe ul > li > ol')
- $ulf.nextAll('ol').hide();
- $('#commentaire-philosophe ul > li:nth-child(1) ol').show();
- $mark.parent().children('p').css("text-decoration","underline");
- $ulf.on("click", function(event) {
- $(this).nextAll('ol').toggle(function() {
- $(this).css({
- "max-height" : "0",
- "opacity" : "0",
- "margin-left" : "0",
- });
- }, function() {
- $(this).css({
- "max-height" : "auto",
- "opacity" : "1",
- "margin-left" : "30px",
- });
- });
- });
- };
- function openmenu_ui() {
- $('.menu-ui').on("click", function(event) {
- $('.navigation').slideToggle('slow');
- });
- //bug here
- $('section').on("click", function(event) {
- $('.navigation').slideUp('slow');
- });
- };
- function redimensionnement() {
- var result = document.getElementById('result');
- if("matchMedia" in window) { // Détection
- if(window.matchMedia("(min-width: 955px)").matches) {
- scrollbar();
- scrollW();
- clickd();
- } else {
- openmenu_ui();
- scrollTop();
- }
- }
- }
- $(document).ready(function(){
- addclass();
- gallery();
- Openfp();
- liclick();
- redimensionnement();
- window.addEventListener('resize', redimensionnement, false);
- });
- })(jQuery);
|