[jQuery] Superfish navigation sometimes doesn't show submenus

2009-10-28 Thread suntrop

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.

2009-08-11 Thread suntrop

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 UL 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)

ul id=navigation
liHome/li
lispanProducts/span
ul class=level2
liProduct A/li
lispanProduct B/span
ul class=level3
liProduct B Info/li
/ul
/li
liProduct C/li
/ul
/li
lispanTeam/span
ul class=level2
liBoss/li
liSales Team/li
liBob/li
/ul
/li
liContact/li
/ul

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?

2008-12-22 Thread suntrop

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 ricardob...@gmail.com 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 sprungm...@googlemail.com 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 chris.mis...@gmail.com 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 sprungm...@googlemail.com 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?

2008-12-21 Thread suntrop

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 chris.mis...@gmail.com 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 sprungm...@googlemail.com 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] Select nested ul inside a li element

2008-11-06 Thread suntrop

Hi. I want to collapse my navigation. But I can't select the nested
ul inside a li
The markup:
ul id=navigation
liFruits
   ul
  liApples/li
  liBananas/li
  liStrawberries/li
   /ul
 /li
 liVegetables
ul
  liTomatoes/li
  liPeas/li
   /ul
 /li

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: Select nested ul inside a li element

2008-11-06 Thread suntrop

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] Re: Match the filename to highlight current link on page

2008-10-13 Thread suntrop

No one can help?

I tought with jquery one can select everything!


[jQuery] Re: Match the filename to highlight current link on page

2008-10-08 Thread suntrop

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;idocument.links.length;i++) {
var linkhref = document.links[i].href;

var strTest = document.URL;

var pos = linkhref.indexOf (strTest);

if(pos-1  document.links[i].parentNode.nodeName==LI  
strTest!
=http://www.amikron.de/;){
document.links[i].style.color=#c03;
}
}


[jQuery] Re: Match the filename to highlight current link on page

2008-10-08 Thread suntrop

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;idocument.links.length;i++) {
var linkhref = document.links[i].href;

var strTest = document.URL;

var pos = linkhref.indexOf (strTest);

if(pos-1 
document.links[i].parentNode.nodeName==LI  strTest!
=http://www.domain.tld/;){
document.links[i].style.color=#c03;
}
}


[jQuery] Match the filename to highlight current link on page

2008-10-06 Thread suntrop

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

2008-09-22 Thread suntrop

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:
h1{$ent.firma} a href={$ent.id} class=makeFavorite
id={$ent.id} title=Save favoriteimg src=images/{if $ent.favorit
== 1}favorites.png{else}favorites2.png{/if} width=16 height=16
alt= //a/h1

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
 a 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 (a element) id and the
   seccond is a response from an php script.

   Can somebody please help me?


[jQuery] Re: Insert variable into a selector

2008-09-22 Thread suntrop

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:
  h1{$ent.firma} a href={$ent.id} class=makeFavorite
  id={$ent.id} title=Save favoriteimg src=images/{if $ent.favorit
  == 1}favorites.png{else}favorites2.png{/if} width=16 height=16
  alt= //a/h1

  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
   a 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 (a 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

2008-09-22 Thread suntrop

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

2008-09-22 Thread suntrop

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)
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html xmlns=http://www.w3.org/1999/xhtml; xml:lang=de
head
meta http-equiv=content-type content=text/html; 
charset=utf-8 /

titleWerbetrommel/title
link rel=stylesheet type=text/css href=http://
yui.yahooapis.com/2.5.2/build/reset-fonts-grids/reset-fonts-
grids.css
link rel=stylesheet type=text/css href=http://
yui.yahooapis.com/2.5.2/build/base/base-min.css
link rel=stylesheet type=text/css href=css/master.css
script type=text/javascript src=js/jquery-1.2.6.pack.js/
script
script type=text/javascript
{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}
/script
/head
body
div id=wrapper
div id=header
img src=/images/core/logo.png width= 
height= title=
alt= /
div id=searchRow
form action= id=searchBox 
method=post
input type=text /
/form
/div
div id=alphabetRow
ul
lia/li
lib/li
liy/li
liz/li
/ul
/div
div id=addRow
img src=images/add.png width=32 
height=32 title=Neuen
Interessenten hinzufügen alt=Hinzufügen /
/div
/div!-- end #header --

div id=listing
div id=control
a href=# id=displayAll title=Alle 
User vollständig
einblendenAlle einblenden/a - a href=# id=displayNone
title=Alle User ausbendenAlle ausblenden/a
/div
{foreach from=$eintrag item=inhalt}
h1{$inhalt.firma} a href={$inhalt.id} 
class=makeFavorite
id={$inhalt.id} title=Als Favorit speichernimg src=images/{if
$inhalt.favorit == 1}favorites.png{else}favorites2.png{/if}
width=16 height=16 alt= //a/h1
div id=customer_{$inhalt.id} 
class=customer
div class=user
h2Empfänger/h2
p{$inhalt.name}/p
p{$inhalt.adresse|nl2br}/p
p{$inhalt.email}br /a 
href={$inhalt.website}
title={$inhalt.website}{$inhalt.website}/a/p
/div!-- end .user --

  

[jQuery] Insert variable into a selector

2008-09-21 Thread suntrop

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 (a element) id and the
seccond is a response from an php script.


Can somebody please help me?


[jQuery] Re: Change user status with AJAX

2008-09-16 Thread suntrop

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;}

 );

 }

 )

 td class=changea href=/admin/favorites/changestatus/5/favorite/
 class=statusimg src=/img/icon_0.png alt= //a/td

 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:
  a href={$user.id} class=makeFavorite id=makeFavorite-{$user.id}
  title=Save as favoriteimg src=images/{if $user.favorit ==
  1}favorites.png{else}favorites2.png{/if} width=16 height=16
  alt= //a

  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:
  ?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!