hm i updated the site but that doesnt help for the jumps Klaus Hartl schrieb: > Klaus Hartl schrieb: > >> Alexander Petri schrieb: >> >>> Hi, >>> i built a very small Demosite using CodeIgniter and jQuery. >>> >>> http://www.konzept-b.net/ci_2/index.php >>> >>> As you can see there is a strange effect if you click on "Kommentar"... >>> on IE first it slides up, and then down. >>> on FF it jumps up and down. >>> could anyone help me to let that work smooth? >>> >>> >>> // JavaScript Document >>> $(document).ready(function(){ >>> $("[EMAIL PROTECTED]'kommentar\']").click(function(e){ >>> e.preventDefault(); >>> var href=$(this).href(); >>> var me = this; >>> $.get(href,function(r) { >>> $(me).parent().next().html(r); >>> $(me).parent().next().slideDown("slow"); >>> }); >>> >>> $(this).html("hide comments"); >>> $(this).unbind("click"); >>> $(this).toggle(function(){ >>> //alert($(this).next().html()); >>> $(this).parent().next().slideUp("slow"); >>> $(this).html("show comments"); >>> },function(){ >>> $(this).parent().next("div").slideDown("slow"); >>> $(this).html("hide comments"); >>> }); >>> }); >>> }); >>> >> Alexander, right now I have only condensed the code a bit - more >> chaining for better performance: >> >> $(document).ready(function(){ >> $("[EMAIL PROTECTED]'kommentar']").click(function(e) { >> e.preventDefault(); >> var me = this; >> var href = this.href; >> $.get(href, function(r) { >> $(me).parent().next().html(r).slideDown("slow"); >> }); >> $(this).html("hide comments").toggle(function() { >> //alert($(this).next().html()); >> $(this).html("show >> comments").parent().next("div").slideUp("slow"); >> }, function() { >> $(this).html("hide >> comments").parent().next("div").slideDown("slow"); >> }); >> }); >> }); >> >> Funny, I'm working on a similiar thing right now, so I will get back to >> you soon... :-) >> > > Just turn around the order of the functions in toggle: > > $(this).html("hide comments").toggle(function() { > $(this).html("hide comments").parent().next("div").slideDown("slow"); > }, function() { > $(this).html("show comments").parent().next("div").slideUp("slow"); > }); > > > From the API docs: The first function is going to be executed on every > even click (0,2,...), the second function on every odd click... > > This is a bit misleading in the docs, because I would think the first > click is 1, thus odd. > > > -- Klaus > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > >
-- mit freundlichen gruessen, Alexander Petri - - - - - - - - - - - - - - Alexander Petri Dipl.-Ing. (FH) Cronstettenstrasse 55 60322 Frankfurt fon +49.(0)69.67738919 mob +49.(0)173.7360855 mail [EMAIL PROTECTED] - - - - - - - - - - - - - - diese email enthaelt vertrauliche und/oder rechtlich geschuetzte informationen. wenn sie nicht der richtige adressat sind oder diese email irrtuemlich erhalten haben, informieren sie bitte sofort den absender und vernichten sie diese mail. das unerlaubte kopieren sowie die unbefugte weitergabe dieser mail ist nicht gestattet. this email may contain confidential and/or privileged information. if you are not the intended recipient (or have received this email in error) please notify the sender immediately and destroy this email. any unauthorized copying, disclosure or distribution of the material in this email is strictly forbidden. = = = = = = = = = = = = = = = = = = = = = = = = = = = =
_______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/