otcn / notamuse

Website for notamuse — A Project investigating the visibility of female graphic designers
1 stars 0 forks source link

Scroll von Nav Spezialfrage zur richtigen Interviewfrage #128

Closed janareddemann closed 6 years ago

janareddemann commented 6 years ago
 var fid;
  /* JANAS AJAX FUNCTIONS ================================================ */

  // History
  function projects(uid) {
    if (uid !== 'about') {
      $.ajax({
        url: '/' + uid, // url: 'http://localhost/~jensschnitzler/' + uid,
        type: 'POST',
        success: function(response) {
          $('.interview-container').html(response);
          $('.interview-container').removeClass('hidden');
          $('#separator').removeClass('hidden');
          classyLinks(); // adds classes to internal and external links in interviews -> see "classy-links.js"
          if (fid){
              $('.interview-container').animate({
                scrollTop: $('#' + fid).offset().top
              }, 300);
          }
        },
        error: function() {
          console.log('ajax error');
        }
      });
    }
  }
  $('.nav-question a').click(function(e) {
    closeTopics();

    var anchor = $(this);
    if (anchor.attr('href').indexOf('http') == -1) {
      openAnswer(anchor);
    } else {
      e.preventDefault();

      var myURL = anchor.attr('href').split('#')[0]; // "split('#')[0]" -> split string into array at "#" and take first array element
      var myID = anchor.attr('href').split('#')[1];
      fid = anchor.attr('href').split('#')[1];

      push(myURL);
    }
  });
jensschnitzler commented 6 years ago

👍 code ist drinne, sollte funktionieren, test and close, por favor