Javascript callback after disqus is loaded?

2,455 views
Skip to first unread message

samuel99

unread,
Sep 3, 2010, 2:48:38 AM9/3/10
to DISQUS Developers
Hi!

We are setting up Disqus for a client and we are having a layout issue
we cannot find an solution for.

Our site is built up using three columns: navigation, main content
(where the disqus comments are located) and a right column.

Our client thinks it’s _very important_ that these columns have the
same height. So, when the DOM is loaded we execute a javascript to
equalize the height of the columns based on the column with most
content in it.

Now here is the issue: Our script executes to soon if we run it on
document.ready, so the disqus comments are flowing outside its
containing <div>.

So, two questions:
Are there any callbacks that I can use to fire our script when the
comments are ready and loaded?
Are there any callbacks that I can use to fire our script when someone
has made a comment?

Anton Kovalyov

unread,
Sep 6, 2010, 3:55:51 PM9/6/10
to disqu...@googlegroups.com
Hi,

JavaScript API that supports those callbacks is not publicly released yet but will be soon.

Anton


viatropos

unread,
Sep 6, 2010, 8:05:59 PM9/6/10
to Disqus Developers
I made a jquery plugin that does this. You can try that out in the
mean time:

http://viatropos.com/blog/jquery-disqus-plugin/

Hope that helps,
Lance

On Sep 6, 2:55 pm, Anton Kovalyov <an...@kovalyov.net> wrote:
> Hi,
>
> JavaScript API that supports those callbacks is not publicly released yet
> but will be soon.
>
> Anton
>

samuel99

unread,
Sep 14, 2010, 10:03:40 AM9/14/10
to Disqus Developers
Thanks guys, will test this out!

Do you know a release date? This month? This year? Q1 2011?

//Samuel

samuel99

unread,
Sep 15, 2010, 8:23:51 AM9/15/10
to Disqus Developers
It may be my lack of skills. But i cannot get this plugin to work the
way i want.

At initial page load the call back works as intended, but not when
pressing the answer-button or if i post a new comment.

I've linked my page to the jquery.disqus.js and in the page header ive
got:
<script type="text/javascript">

$(document).ready(function() {

$('#disqus_thread').disqus({
domain: "ourdemoaccount",
title: document.title,
developer: window.location.hostname == "client.local" ? 1 : 0,
show_count: true,
prettify: false,
markdown: false,
ready: function() {
console.log("ready");
framework.setcolheights();
},
added: function(comments) {
console.log("added");
framework.setcolheights();
},
edit: function(textarea) {
console.log("edited");
framework.setcolheights();
}
});
});
</script>

When loading the page with comments both the "ready" and the
"comments"-call back runs. But no call back when posting or answering
a comment.


Ideas? :/



On 7 Sep, 02:05, viatropos <lancejpoll...@gmail.com> wrote:

samuel99

unread,
Sep 27, 2010, 2:34:27 AM9/27/10
to Disqus Developers
If anyone has any clues on my issue, or an alternative solution from
the one above, id be very happy!

neoascetic

unread,
Mar 30, 2012, 10:46:54 PM3/30/12
to disqu...@googlegroups.com
So... Public JS API doesn't released yet?

loupiote

unread,
Jun 19, 2013, 10:33:43 PM6/19/13
to disqu...@googlegroups.com
i too would love an option to pass a callback name e.g. as a parameter to the disqus script.

the idea is the the callback would be called once disqus is loaded and once the iframes in the "disqus_thread" div are created (i.e. once we know their dimension, since they impact the page layout, and cannot be predicted before the disqus script is loaded.

loupiote

unread,
Jun 19, 2013, 10:36:23 PM6/19/13
to disqu...@googlegroups.com
just found this:

i'll look into it, maybe it will provide me a suitable solution.

Burak Yiğit Kaya

unread,
Jun 19, 2013, 11:06:07 PM6/19/13
to disqu...@googlegroups.com
onReady should do the trick for you.


--
You received this message because you are subscribed to the Google Groups "Disqus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to disqus-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
BYK

Huston Malande

unread,
Jun 3, 2014, 4:41:08 PM6/3/14
to disqu...@googlegroups.com
Someone might find this helpful: How to Run a Function After Disqus for WordPress has Loaded

It's written for WordPress, but you just need to pick out the JavaScript snippet.
Reply all
Reply to author
Forward
0 new messages