[jQuery] Superfish navigation sometimes doesn't show submenus
Hi there. I am testing the superfish plugin on a site and it works fine besides sometimes the submenus doesn't appear. I have to move the pointer outside the link and wait until the hover class disappears and mouse over again. Does anybody know where this error could came from? Or someone with similar behaviors with the plugin? Thanks!!
[jQuery] A complicated menu. Need some help.
My navigation menu is quite complicated and I can't get it working. Can someone please help? That's what I want and have until now: A nested menu that slides to the left if I click a link with sub- menus and fade in the sub-menu. (sub-menus are not displayed by default via css) Home Products Product A Product B Product B Info Product C Team Boss Sales Team Bob Contact jQuery: $("#navigation span").click(function () { // move the whole ul#navigation 100px to the left $(this).parent().parent().animate({left:'-100px'},'slow'); // … and show the first submenu level2 (links products a-c) $(this).next.show(); // but how can I 'see' if it is a nested span I click on and move #navigation and the nested ul? // and maybe the #navigation the nested ul and another nested ul? }); Thanks a million for any help!!
[jQuery] Re: Can I "access" and change content loaded dynamically after jQuery.js?
Ryura thanks for the link. I'll try it although I want to learn and know how to deal without a plugin :) Ricardo, this looks like it does what I want :) Let's say I want the content (loaded via the load method) hide/show or catch some clicks inside it. Then I have to put all the code for all pages I'll load inside the callback function? $("#content").load(loadLink, function(){ hideLoader(); // Hide DIV1 // click this and make that // some code for page 1 // code for page 2,3 … // open new window by clicking on … // and so on }) Is this the appropriate way, how it's done in most cases? Hope you can send me answer and thanks for your help!! On 22 Dez., 02:11, Ricardo Tomasi wrote: > If you add the event handlers to the callback you can get it working: > > $("#content").load(loadLink, function(){ > hideLoader(); > $('.details').hide(); > $('.showDetails').click(function() { > $('.details').slideToggle('slow'); > return false; > }); > > }) > > On Dec 21, 4:20 pm, suntrop wrote: > > > Sorry for that, but how can I bind the event after I call $ > > ("#content").load(loadLink,"",hideLoader);? > > > Do I have to replace hideLoader with a function that contains all the > > "new" code? > > > Thanks for your help! > > > On 21 Dez., 17:30, DumpsterDoggy wrote: > > > > You can't bind any events to the controls on $(document).ready() if > > > the html isn't there. I would try binding the event after you call $ > > > ("#content").load(loadLink,"",hideLoader); > > > > On Dec 21, 10:17 am, suntrop wrote: > > > > > Hi there. > > > > > I am loading some content into my page … > > > > > $("#content").load(loadLink,"",hideLoader); > > > > > The file behind loadLink (e.g. contact.php) has some tables with > > > > class="details" and I want them to be hidden and not shown until I > > > > click the link before it. > > > > > $('.details').hide(); > > > > $('.showDetails').click(function() { > > > > $('.details').slideToggle('slow'); > > > > return false; > > > > > }); > > > > > But for some reason it doesn't work. The table .details is displayed > > > > and when I click the link .showDetails nothing happens (I tried to > > > > alert something, nothing here too). > > > > > I am afraid of it is not working with content loaded dynamically after > > > > my page with the jQuery JS is loaded. Because jQuery doesn't knows the > > > > "new" .details table??
[jQuery] Re: Can I "access" and change content loaded dynamically after jQuery.js?
Sorry for that, but how can I bind the event after I call $ ("#content").load(loadLink,"",hideLoader);? Do I have to replace hideLoader with a function that contains all the "new" code? Thanks for your help! On 21 Dez., 17:30, DumpsterDoggy wrote: > You can't bind any events to the controls on $(document).ready() if > the html isn't there. I would try binding the event after you call $ > ("#content").load(loadLink,"",hideLoader); > > On Dec 21, 10:17 am, suntrop wrote: > > > Hi there. > > > I am loading some content into my page … > > > $("#content").load(loadLink,"",hideLoader); > > > The file behind loadLink (e.g. contact.php) has some tables with > > class="details" and I want them to be hidden and not shown until I > > click the link before it. > > > $('.details').hide(); > > $('.showDetails').click(function() { > > $('.details').slideToggle('slow'); > > return false; > > > }); > > > But for some reason it doesn't work. The table .details is displayed > > and when I click the link .showDetails nothing happens (I tried to > > alert something, nothing here too). > > > I am afraid of it is not working with content loaded dynamically after > > my page with the jQuery JS is loaded. Because jQuery doesn't knows the > > "new" .details table??
[jQuery] Can I "access" and change content loaded dynamically after jQuery.js?
Hi there. I am loading some content into my page … $("#content").load(loadLink,"",hideLoader); The file behind loadLink (e.g. contact.php) has some tables with class="details" and I want them to be hidden and not shown until I click the link before it. $('.details').hide(); $('.showDetails').click(function() { $('.details').slideToggle('slow'); return false; }); But for some reason it doesn't work. The table .details is displayed and when I click the link .showDetails nothing happens (I tried to alert something, nothing here too). I am afraid of it is not working with content loaded dynamically after my page with the jQuery JS is loaded. Because jQuery doesn't knows the "new" .details table??
[jQuery] Re: Select nested inside a element
This is cool! The find-thing works exactly like I want it :-) Unfortunately the "box" collapses even if I click on a link (Apples). Of course, it's in the li as well. Can I disable that? Thanks for your answers guys!
[jQuery] Select nested inside a element
Hi. I want to collapse my navigation. But I can't select the nested inside a The markup: Fruits Apples Bananas Strawberries Vegetables Tomatoes Peas This is what I tried to do: $('#navigation li').click(function() { $(this).next().slideToggle("fast"); }); But this code doesn't collapse the nested ul but the next li. When I click Fruits it'll toggle Vegetables. How can I select just the ul inside the li? When I click Fruits it should toggle the ul with Apples, Bananas ... This one won't work either: $('#navigation li').click(function() { $(this ' ul').slideToggle("fast"); }); or this: $('#navigation li').click(function() { $(this).child().slideToggle("fast"); }); Hope somebody can help. Thanks!
[jQuery] Re: Match the filename to highlight current link on page
No one can help? I tought with jquery one can select everything!
[jQuery] Re: Match the filename to highlight current link on page
Hi Adrian, thanks for your help but I can't follow you. I have no directories to split - but if, this is a good solution. I think the problem occurs here: $('#navigation [EMAIL PROTECTED]"' + path + '"]') The @href finds all elements which contains the path (filename). And if filename 1 is potatoes.html and another one is fried-potatoes.html it makes both red, because both have potatoes in it. How can I find just the hrefs which are exact the same like path? In the past I had this script, that works. But I want to do it with jquery ;) for(i=0;i-1 && document.links[i].parentNode.nodeName=="LI" && strTest! ="http://www.domain.tld/";){ document.links[i].style.color="#c03"; } }
[jQuery] Re: Match the filename to highlight current link on page
Hi Adrian, thanks for your help but I can't follow you. I have no directories to split - but if, this is a good solution. I think the problem occurs here: $('#navigation [EMAIL PROTECTED]"' + path + '"]') The @href finds all elements which contains the path (filename). And if filename 1 is potatoes.html and another one is fried-potatoes.html it makes both red, because both have potatoes in it. How can I find just the hrefs which are exact the same like path? In the past I had this script, that works. But I want to do it with jquery ;) for(i=0;i-1 && document.links[i].parentNode.nodeName=="LI" && strTest! ="http://www.amikron.de/";){ document.links[i].style.color="#c03"; } }
[jQuery] Match the filename to highlight current link on page
Hi there, I've following code to highlight the current link in my menu: var path = location.pathname.substring(1); if (path != '') { $('#navigation [EMAIL PROTECTED]"' + path + '"]').css('color','#c03'); } else { $('#navigation [EMAIL PROTECTED]"/"]').css('color','#c03'); } But some files/pages have similar names like: potatoes.html fried-potatoes.html The second page highlights the first link (potatoes.html) as well. What's wrong of course. How can I make this bulletproof? Is it possible only to match the exact filename? I would be really glad if someone can help! Regards suntrop
[jQuery] Re: Insert variable into a selector
Hi Michael, I didn't want to screw things up with the complete code, because I thought it is a pretty simple thing :-) So here is the whole code: (I haven't a live page, it is only on my local machine) http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml"; xml:lang="de"> Werbetrommel {literal} $(document).ready(function() { $('.customer').hide(); $("h1").click(function() { $(this).next().slideToggle(); }); $('#displayAll').click(function() { $('.customer').each(function() { $(this).show(); }); return false; }); $('#displayNone').click(function() { $('.customer').each(function() { $(this).hide(); }); return false; }); // Make Favorite $('.makeFavorite').click(function() { var id = this.id; var favimg = "favorites"; $.ajax({ type: "POST", url: "make_favorite.php", data: "id=" + $(this.id), success: function(msg) { alert('Data saved: ' + msg); $('h1 a#'+id+' img').attr({src : "images/"+favimg+".png"}); } }); return false; }); }); {/literal} a b y z Alle einblenden - Alle ausblenden {foreach from=$eintrag item=inhalt} {$inhalt.firma} Empfänger {$inhalt.name} {$inhalt.adresse|nl2br} {$inhalt.email}{$inhalt.website} Mailing Wurf: {$inhalt.wurf}Mailing: {$inhalt.mailing} Zeitpunkte Gesendet I: {$inhalt.gesendet_1}Gesendet II: {$inhalt.gesendet_2}Gesendet III: {$inhalt.gesendet_3} Status Status: {$inhalt.status}FI: {$inhalt.feuer_index} Feedback 1. Kontakt: {$inhalt.erstkontakt}1. Kontakt Typ: {$inhalt.erstkontakt_typ}Termin: {$inhalt.termin}Interessiert an: {$inhalt.interessiert_an} Infos Mängel/VorschlägeKommentar {/foreach}
[jQuery] Re: Insert variable into a selector
When write: $('#' + id + ' img').attr("src", "images/favorites.png"); … it works. alert (msg) says "favorites". There must be something wrong with msg. If the variable is defined before var favimg = "favorites"; and I insert favimg it works just fine. What could be wrong with msg? msg is what I echo back in my PHP code. I don't know if this is the appropriate way. On 22 Sep., 13:34, MorningZ <[EMAIL PROTECTED]> wrote: > "But the image isn't replaced correctly" > > Perhaps try changing this line instead > > $('#' + id + ' img').attr("src", "images/"+msg+".png"); > > There's no reason why that (or your line for that matter) wouldn't > work as long as the selector finds something and the value of the > "src" is a valid path on your server
[jQuery] Re: Insert variable into a selector
Thanks Erik. It helped! The id is inserted correctly. But the image isn't replaced correctly. What code should I sow you more Makisa? The other code isn't affected with this. What do you mean? On 22 Sep., 10:26, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > you concatenate a string with an object.. > > On 22 Sep., 10:16, suntrop <[EMAIL PROTECTED]> wrote: > > > This is the JS code: > > $('.makeFavorite').click(function() { > > $.ajax({ > > type: "POST", > > url: "make_favorite.php", > > data: "id=" + $(this.id), > > success: function(msg) { > > alert('Data saved: ' + msg); > > $('h1 a#' + this.id + ' img').attr({src : > > "images/"+msg+".png"}); > > } > > }); > > return false;}); > > > The HTML code: > > {$ent.firma} > id="{$ent.id}" title="Save favorite"> > alt="" /> > > > Both variables don't do what what I expect them to do. The first > > doesn't find the correct target/id and the seccond doesn't insert the > > image correctly. But if I write down the id and the true path it works > > fine. > > > What do I have to change? > > > On 22 Sep., 05:42, ricardobeat <[EMAIL PROTECTED]> wrote: > > > > I can't get it either, what are you trying to accomplish? > > > > $('h1 a#' + this.id') is not logical, you first need to reference some > > > element to get it's ID, but in doing that you already wrote the > > > ID... > > > > On Sep 21, 11:16 pm, FrenchiINLA <[EMAIL PROTECTED]> wrote: > > > > > i think your problem is this.id, you have to show the entire code in > > > > order for us to see what does this mean. try just to add a alert for > > > > example to see what you get for this.id > > > > > On Sep 21, 7:38 am, suntrop <[EMAIL PROTECTED]> wrote: > > > > > > HI there, > > > > > > I want to insert two variables into the selector and an attribute. But > > > > > it doesn't work. > > > > > > $('h1 a#' + this.id + ' img').attr({src : "images/" + msg + ".png"}); > > > > > > I looked through various tutorials but couldn't find an answer to > > > > > this. > > > > > > The first variable comes from the object's ( element) id and the > > > > > seccond is a response from an php script. > > > > > > Can somebody please help me?- Zitierten Text ausblenden - > > > - Zitierten Text anzeigen -
[jQuery] Re: Insert variable into a selector
This is the JS code: $('.makeFavorite').click(function() { $.ajax({ type: "POST", url: "make_favorite.php", data: "id=" + $(this.id), success: function(msg) { alert('Data saved: ' + msg); $('h1 a#' + this.id + ' img').attr({src : "images/"+msg+".png"}); } }); return false; }); The HTML code: {$ent.firma} Both variables don't do what what I expect them to do. The first doesn't find the correct target/id and the seccond doesn't insert the image correctly. But if I write down the id and the true path it works fine. What do I have to change? On 22 Sep., 05:42, ricardobeat <[EMAIL PROTECTED]> wrote: > I can't get it either, what are you trying to accomplish? > > $('h1 a#' + this.id') is not logical, you first need to reference some > element to get it's ID, but in doing that you already wrote the > ID... > > On Sep 21, 11:16 pm, FrenchiINLA <[EMAIL PROTECTED]> wrote: > > > i think your problem is this.id, you have to show the entire code in > > order for us to see what does this mean. try just to add a alert for > > example to see what you get for this.id > > > On Sep 21, 7:38 am, suntrop <[EMAIL PROTECTED]> wrote: > > > > HI there, > > > > I want to insert two variables into the selector and an attribute. But > > > it doesn't work. > > > > $('h1 a#' + this.id + ' img').attr({src : "images/" + msg + ".png"}); > > > > I looked through various tutorials but couldn't find an answer to > > > this. > > > > The first variable comes from the object's ( element) id and the > > > seccond is a response from an php script. > > > > Can somebody please help me?
[jQuery] Insert variable into a selector
HI there, I want to insert two variables into the selector and an attribute. But it doesn't work. $('h1 a#' + this.id + ' img').attr({src : "images/" + msg + ".png"}); I looked through various tutorials but couldn't find an answer to this. The first variable comes from the object's ( element) id and the seccond is a response from an php script. Can somebody please help me?
[jQuery] Re: Change user status with AJAX
Hi, and thanks for the help. the server side code is above. It seems to be correct. I guess the JS isn't working correct since there is no new connection as I see in the status bar. Nothing happens when I click the link. Thanks for the code Andreas! I am sorry but I can understand it in detail. This is only for changing the image? But where and how can I integrate it into my code? And where can I update the DB? Hope you can help me little bit more :-) Thanks a million! On 14 Sep., 22:34, "Andras Kende" <[EMAIL PROTECTED]> wrote: > Hello, > > I have this for a toggling, debug with firebug so you could see whats > happening: > > jQuery(document).ready(function() { > > jQuery("a.status").unbind("change"); > jQuery("a.status").click(function(){ > var p = this.firstChild; > if (p.src.match('icon_1.png')) { > jQuery(p).attr({ src: "/img/icon_0.png", alt: "Activate" });} else { > > jQuery(p).attr("src","/img/icon_1.png"); > jQuery(p).attr("alt","Deactivate");}; > > jQuery.get(this.href + "?" + new Date().getTime() ); > return false;} > > ); > > } > > ) > > class="status"> > > Andras Kendehttp://www.kende.com/ > > On Sun, Sep 14, 2008 at 7:36 AM, suntrop <[EMAIL PROTECTED]> wrote: > > > I am sorry if this was posted twice! > > > --- > > > Hi, > > > I have a list of users that I pull out of a MySQL DB. Some are > > "favorite" users marked with a star. > > Now I want to change the state "is favorite/is not favorite" quickly > > with a click on the star image, and the image should turn directly to > > its state yellow(is favorite) or grey(is not favorite). > > > This is how the link and image looks like: > > > title="Save as favorite"> > alt="" /> > > > The JS look like this: > > // Make Favorite > > $('.makeFavorite').click(function() { > >$.ajax({ > >type: "POST", > >url: "make_favorite.php", > >data: "id=19", > >success: function(msg) { > >alert('Data saved: ' + msg); > >} > >}); > >return false; > > }); > > > The PHP: > > > …mysql connect … > > $sql = "UPDATE table SET favorite='1' WHERE id=$_POST[id]"; > > > mysql_query($sql); > > > echo 'My Msg: id is: ' . $_POST['id']; > > ?> > > > But unfortunately it doesn't work :( > > The Msg says "My Msg: id is 19" but the state in the DB won't update. > > > Since this is the very first time I'm dealing with AJAX it is a quite > > big thing for me :-) > > > What is wrong with the code above? And how can I change the image > > directly without reloading the page? > > > Hope you get what I want to do and can help me. Thanks!