2

JSFiddle The fiddle works as intended using the same exact code from my site! Copy and pasted.

My site

To replicate this issue you have to do these steps exactly. Go to a fresh load of the page. Scroll to the bottom and click "Contact" in the middle column. Now when you try and select the form options, the dropdown closes. Why is this happening? The fiddle has the exact same code, JS and all. On a fresh load, the toggle button by itself works as intended. Once the "contact" link is brought in, it breaks.

Here is the custom script I wrote to scroll to the top and open the dropdown.

// Scroll To Top and Open Contact Form -->
$("a[href='#top']").click(function() {
  $("html, body").animate({ scrollTop: 0 }, "slow");
  return false;
});
$("a[href='#top']").click(function() {
  $('#nav-contact.dropdown-toggle').dropdown('toggle');
  return false;
}); 
<!--// End Contact Form Scripts -->

I don't really know any JS but I'm trying to learn to put this site together as a personal project for enrichment. Any explanations would be greatly appreciated.

Ideas?

1
  • The Fiddle ins't working anymore :( Commented Oct 10, 2013 at 15:53

1 Answer 1

2

The jsfiddle working fine for me too, but you could actually try like this,

$("a[href='#top']").click(function (e) {
    $("html, body").animate({
        scrollTop: 0
    }, "slow", function () {
        $('#nav-contact.dropdown-toggle').dropdown('toggle');
    });
    return false;
});

calling the toggle within the callback.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.