Me gusta el diseño de iframe de ajax del botón volviendo al estándar desde el recuento de botones

Looking and searching i almost don't expect a reply ;) as i don't think it seems many people have tried this. The problem is relatively small and i'm more hoping somebody has had the same problem. So we shall see.

//when share is clicked remove all content in share and add in facebook's like button
$('#flb').live('click',function(){

    var ID = $('#question-shell').attr('data-id');

    $( '#flbCont' ).empty().append( $('<iframe />')
        .attr( 'src', 'http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.wouldyourather.eu%2F%3Fid%3D'+ ID +'&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=21' )
        .attr( 'scrolling', 'no' )
        .attr( 'frameborder', 'no' )
        .attr( 'style', 'border:none; overflow:hidden; width:450px; height:80px;' )
        .attr( 'allowTransparency', 'true' )
    );

    return false;
});

this is my code. Simple just remove whatever is in the facebook share place-holder already and add the new dynamic content. But the style when it gets jqueryed in has the standard display even though in the html it says its should have loaded the standard instead of the button_count version.

Any thoughts at all would be brill :)

Animo amigos

preguntado el 08 de enero de 11 a las 23:01

5 Respuestas

Just move the "href" param in the querystring to be the last param. In your code you would change it to

.attr( 'src', 'http://www.facebook.com/plugins/like.php?layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=21&amp;href=http%3A%2F%2Fwww.wouldyourather.eu%2F%3Fid%3D'+ ID)

Espero que esto ayude.

Respondido 17 Feb 12, 20:02

Make sure the '&amp' isn't getting stripped off the end of the url you are Liking. This will cause the layout to not be set correctly and default to 'standard'.

Respondido el 12 de enero de 11 a las 12:01

cheers for the reply dude... its nice to know somebody cares :) well i've edited the code to read like this but still no luck, its still defaulting to standard :( $( '#flbCont' ).empty().append( $('<iframe />') .attr( 'src', 'facebook.com/plugins/… ID +'&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=21&amp' ) - Jamie Hutber

I had the same problem and removed the amp; and left the ampersand character and that seemed to fix it. Hope this helps - I looked for a while too.

Respondido el 24 de enero de 11 a las 01:01

sadly none of the following worked so i just had to re-design the feature slightly :( - Jamie Hutber

In the end i used .load() and put the code in a separate page and loaded that in.

Respondido el 21 de junio de 12 a las 14:06

I don't know if this late reply still help any more, but hope others who are also struggling with this can see it.

I found that if I change all the &amp; to & then it worked!

respondido 11 mar '14, 21:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.