[jQuery] Re: can someone please help with dynamic links problem?

2008-10-22 Thread Flavio333


Thank You so much, after playing around with it ... it works!!!
Thank You SO SO Much!!!












RotinPain wrote:
 
 
 Sure, how i could miss that!
 
 I would assign the categories Id number (like $catid) in the Id
 attribute of the link. Then using it as a GET parameter for the load
 function.
 It would give:
  #  class=generate2?=$catname;? 
 
 Then modify the function i wrote (based on the classname) using:
 $(#myobj).load(products.php?idctg_ctg= + $(this).attr(id) )
 
 Here's the complete script (tested!) from your source:
 [SCRIPT]
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://
 www.w3.org/TR/html4/loose.dtd
 html
 head
 script src=scripts/jquery.js/script
 script
 $(document).ready(function(){
 
 $(.generate2).each (
   function () {
   $( this ).bind (
 click,
 function() {
 
   $(#myobj).fadeOut(fast);
   $(#myobj).slideToggle(slow);
   $(#myobj).load(products.php?idctg_ctg= + $(this).attr('id') 
 );
   // id will be the one of the clicked link
 
   }//function
 );//bind
   }//function
 );//each
 
 });
 /script
 style type=text/css
 !--
 #myobj {
   background-color: #CC;
   height: 300px;
   width: 500px;
 }
 --
 /style
 /head
 body
 div id=myobj align=center
   ?php do { ?
  # ?php echo
 $row_categorys['name_ctg']; ? br
   ?php } while ($row_categorys = mysql_fetch_assoc($categorys)); ?
 /div
 /body
 /html
 ?php mysql_free_result($categorys); ?
 
 But you can have a look at ricardobeat link ;)
 
 
 On 21 oct, 20:57, Flavio333 [EMAIL PROTECTED] wrote:
 I tried what you said but it does not work... now both links go to the
 same
 page when clicked...





 RotinPain wrote:

  the problem is quite simple i think, all your links have the same id
  (generate2)
  And the jquery function is attached to a link with this id (generate2)
  So only 1 link will be responding to the function.

  You need to use each() to attach an event to each links. Like

  $(#generate2).each (
    function () {
      $( this ).bind (
        click,
        function(){
          //dosomething your stuff here
        }//function
      );//bind
    }//function
  );//each

  This should normally work. But note that only one unique ID per page
  is acceptable (see W3C recommandations). Better to use class name
  filtering instead (there could be more than 1 time the same class on
  the page but only 1 unique id).
  It will only change the first line:
  $(.generate2).each ( ...

  And the HTML will looks like
   # ...

  On Oct 21, 3:56 pm, Flavio333 [EMAIL PROTECTED] wrote:
  Hello, I an quite new to jquery and hope someone can help with my
  problem.  I
  am trying to load dynamic content in to a div(myobj)... the code i
 have
  so
  far is more or less as follows.  it creates a box with 2 links, that
 it
  gets
  from 'name_ctg'.  the links, are category names and when clicked
 should
  load
  products.php, with the right product, as was determined by the link
 that
  was
  clicked.  I hope that make sense...  now the problem is that only the
  first
  link works, the second link does nothing.  I hope someone can help.

  script src=jquery.js/script

   script
    $(document).ready(function(){
   $(#generate2).click(function(){  
           $(#myobj).fadeOut(fast);
   $(#myobj).slideToggle(slow);
   $(#myobj).load(products.php?idctg_ctg=?php echo
  $row_categorys['idctg_ctg']; ?);
    });

   });
    /script

   style type=text/css
  !--
  #myobj {
   background-color: #CC;
   height: 300px;
   width: 500px;}

  --
   /style
  /head

  body

  div id=myobj align=center
    ?php do { ?  
     a  href=# id=generate2 ?php echo $row_categorys['name_ctg'];
 ?
  br
    ?php } while ($row_categorys = mysql_fetch_assoc($categorys)); ?
     /div
  /body
  /html
  ?php
  mysql_free_result($categorys);
  ?

  --
  View this message in
 
 context:http://www.nabble.com/can-someone-please-help-with-dynamic-links-prob...
  Sent from the jQuery General Discussion mailing list archive at
  Nabble.com.

 --
 View this message in
 context:http://www.nabble.com/can-someone-please-help-with-dynamic-links-prob...
 Sent from the jQuery General Discussion mailing list archive at
 Nabble.com.- Masquer le texte des messages précédents -

 - Afficher le texte des messages précédents -
 
 
:clap::clap::clap::clap:
-- 
View this message in context: 
http://www.nabble.com/can-someone-please-help-with-dynamic-links-problem--tp20090838s27240p20116087.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] can someone please help with dynamic links problem?

2008-10-21 Thread Flavio333


Hello, I an quite new to jquery and hope someone can help with my problem.  I
am trying to load dynamic content in to a div(myobj)... the code i have so
far is more or less as follows.  it creates a box with 2 links, that it gets
from 'name_ctg'.  the links, are category names and when clicked should load
products.php, with the right product, as was determined by the link that was
clicked.  I hope that make sense...  now the problem is that only the first
link works, the second link does nothing.  I hope someone can help.

  

 

script src=jquery.js/script

 script
  $(document).ready(function(){
 $(#generate2).click(function(){  
 $(#myobj).fadeOut(fast);
 $(#myobj).slideToggle(slow);
 $(#myobj).load(products.php?idctg_ctg=?php echo
$row_categorys['idctg_ctg']; ?);
  });
 
 }); 
  /script

 style type=text/css
!--
#myobj {
 background-color: #CC;
 height: 300px;
 width: 500px;
}
--
 /style
/head

body

div id=myobj align=center
  ?php do { ?  
   a  href=# id=generate2 ?php echo $row_categorys['name_ctg']; ?
br
  ?php } while ($row_categorys = mysql_fetch_assoc($categorys)); ?
   /div
/body
/html
?php
mysql_free_result($categorys);
?

-- 
View this message in context: 
http://www.nabble.com/can-someone-please-help-with-dynamic-links-problem--tp20090838s27240p20090838.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: can someone please help with dynamic links problem?

2008-10-21 Thread Flavio333


I tried what you said but it does not work... now both links go to the same
page when clicked...






RotinPain wrote:
 
 
 the problem is quite simple i think, all your links have the same id
 (generate2)
 And the jquery function is attached to a link with this id (generate2)
 So only 1 link will be responding to the function.
 
 You need to use each() to attach an event to each links. Like
 
 $(#generate2).each (
   function () {
 $( this ).bind (
   click,
   function(){
 //dosomething your stuff here
   }//function
 );//bind
   }//function
 );//each
 
 This should normally work. But note that only one unique ID per page
 is acceptable (see W3C recommandations). Better to use class name
 filtering instead (there could be more than 1 time the same class on
 the page but only 1 unique id).
 It will only change the first line:
 $(.generate2).each ( ...
 
 And the HTML will looks like
  # ... 
 
 On Oct 21, 3:56 pm, Flavio333 [EMAIL PROTECTED] wrote:
 Hello, I an quite new to jquery and hope someone can help with my
 problem.  I
 am trying to load dynamic content in to a div(myobj)... the code i have
 so
 far is more or less as follows.  it creates a box with 2 links, that it
 gets
 from 'name_ctg'.  the links, are category names and when clicked should
 load
 products.php, with the right product, as was determined by the link that
 was
 clicked.  I hope that make sense...  now the problem is that only the
 first
 link works, the second link does nothing.  I hope someone can help.

 script src=jquery.js/script

  script
   $(document).ready(function(){
  $(#generate2).click(function(){  
          $(#myobj).fadeOut(fast);
  $(#myobj).slideToggle(slow);
  $(#myobj).load(products.php?idctg_ctg=?php echo
 $row_categorys['idctg_ctg']; ?);
   });

  });
   /script

  style type=text/css
 !--
 #myobj {
  background-color: #CC;
  height: 300px;
  width: 500px;}

 --
  /style
 /head

 body

 div id=myobj align=center
   ?php do { ?  
    a  href=# id=generate2 ?php echo $row_categorys['name_ctg']; ?
 br
   ?php } while ($row_categorys = mysql_fetch_assoc($categorys)); ?
    /div
 /body
 /html
 ?php
 mysql_free_result($categorys);
 ?

 --
 View this message in
 context:http://www.nabble.com/can-someone-please-help-with-dynamic-links-prob...
 Sent from the jQuery General Discussion mailing list archive at
 Nabble.com.
 
 

-- 
View this message in context: 
http://www.nabble.com/can-someone-please-help-with-dynamic-links-problem--tp20090838s27240p20097081.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] load dynamic content into myobj

2008-10-20 Thread Flavio333


Hello,

what I am trying to do is this... I have a link on a page when i click the
link i want it to load Page2.php?+... into myobj.
here is some of the code i was working with... hope someone can help...
Thank you.


 script
  $(document).ready(function(){
   $(#generate2).click(function(){  
 $(#myobj).fadeOut(fast);
  $(#myobj).slideToggle(slow);
$(#myobj).load( what goes here );
 $(this).toggleClass(active);
});
 }); 
  /script


  *

div id=myobj align=center
  ?php do { ?  
   Page2.php?idctg_ctg=?php echo $row_categorys['idctg_ctg']; ?  ?php
echo $row_categorys['name_ctg']; ? br
  ?php } while ($row_categorys = mysql_fetch_assoc($categorys)); ?
   /div
-- 
View this message in context: 
http://www.nabble.com/load-dynamic-content-into-myobj-tp20080199s27240p20080199.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] how do I fix the position of an element?

2008-10-02 Thread Flavio333


Hello,
I am a first time JQuery user, and was wondering how would I go about
getting an element, say a php page that I loaded into a small block on my
html page... now when I scroll up, down, left or right I would like this
element(the loaded php page in the small block) to be fixed to the position
on the screen, that is it moves up, down, left or right to compensate for
the users scrolling.  I hope that makes sense.  In advance Thanks for Your
Help!!! 
-- 
View this message in context: 
http://www.nabble.com/how-do-I-fix-the-position-of-an-element--tp19774250s27240p19774250.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.