Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //accordion functionality and animation
- $('.toggle-container').hide();
- $('.toggle-container').each(function () {
- var $container = $(this);
- var $open = $container.siblings('.open-profile');
- var $close = $container.find('.close-profile');
- var $closelink = $('.close-link');
- $open.on('click', function (e) {
- e.preventDefault();
- openSlider($container);
- });
- $close.on('click', function (e) {
- e.preventDefault();
- closeSlider($container, $open);
- });
- $closelink.on('click', function (e) {
- e.preventDefault();
- closeSlider($container, $open);
- });
- });
- function openSlider($container) {
- $('#eligibility-form').show();
- $container.slideDown('fast');
- $('#having-trouble').css('visibility', 'visible');
- /*scroll the page to to the form section*/
- $('html,body').animate({
- scrollTop: $("div#panel1").offset().top
- }, 500);
- /*--------------------------------------*/
- }
- function closeSlider($container, $open) {
- $container.slideUp('fast', function () {
- $('#form_wrapper').find('form').css('left', '0').hide();
- $('#form_wrapper').css('left', '0');
- //TODO: clear all form fields
- $('#having-trouble').css('visibility', 'hidden')
- $open.show();
- /*scroll the page to to the top*/
- $('html,body').animate({
- scrollTop: $("body").offset().top
- }, 500);
- /*-----------------------------*/
- });
- }
- /*if the panel is open on document load, scroll to the panel*/
- $(document).ready(function () {
- if ($("div#panel1").css("display") == "block") {
- /*scroll the page to to the form section*/
- $('html,body').animate({
- scrollTop: $("div#panel1").offset().top
- }, 500);
- /*--------------------------------------*/
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment