Jump to content

Turning this Javascript into Ajax?


TeddyKiller

Recommended Posts

I want to turn this Javascript into JQuery Ajax.. so when its set to display, it'll.. slide down. Just not sure how i'd do it.. any help? Thanks!

 

function showComments(Comment_Menu) {
    Comment_Menu = document.getElementById(Comment_Menu);
    if(Comment_Menu.style.display == "none") {
        Comment_Menu.style.display = "block";
    } else if(Comment_Menu.style.display == "block") {
        Comment_Menu.style.display = "none";
    }
}

 

When you click the ahref, the onclick event calls this function. So basically.. when it gets to display, it should slide down, then it gets to .. hide, to slide up.

Link to comment
https://forums.phpfreaks.com/topic/203137-turning-this-javascript-into-ajax/
Share on other sites

I've used ajax before, and.. with the JQuery plugin, it allows some effects, like slidein slideout, fadeout, fadein etc. I just wanted similar to above... but with that slidein and slideout effect. I could do something similar.. but not with a function call, it'd be a ready function... which doesn't really allow what I'm doing to do.. because it has unique id's and its in a while, it's unique by id's on the div id's... but if it's not possible then.. perhaps maybe you can suggest a solution that'd work?

I've used ajax before, and.. with the JQuery plugin, it allows some effects, like slidein slideout, fadeout, fadein etc. I just wanted similar to above... but with that slidein and slideout effect.

As mentioned before that's not ajax that's just javascript effects. The examples are pretty straight forward in the jQuery documentation http://api.jquery.com/category/effects/

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.