jquery adding another object doesn't work

Discussion in 'HTML & Website Design' started by ExSpirit, Nov 23, 2010.

  1. #1
    I have attached a simple script where you can move small images to larger image. It works fine but I have a problem adding another small objects - they can't be moved, they are just static. Is anyone so good to check what is causing this problem?

    Since I can't attach file larger than 100KB I uploaded it elswere - http://www.speedyshare.com/files/25335693/html.zip (html.zip)
     
    ExSpirit, Nov 23, 2010 IP
  2. CSM

    CSM Active Member

    Messages:
    1,047
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    55
    #2
    Javascript error in line 89 (says Firebug)

    
    for(var i = 0;i<data.images.length;++i){
    
    Code (markup):
    By the way: the function addElement is JavaScript, not jQuery.

    After adding an element you need to "reinitialize" the jQuery UI stuff again since the script is adding classes to the div's on demand.

    Should be moved to this subforum here: http://forums.digitalpoint.com/forumdisplay.php?f=137
     
    Last edited: Nov 23, 2010
    CSM, Nov 23, 2010 IP
  3. ExSpirit

    ExSpirit Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for replay CSM.

    Yeah I added JavaScript code for addElement I thought it will go through. Would it be better to use something else with jQuery which would be much easier?



    If not, how can I "reinitialize" the jQuery UI stuff after adding an element?
     
    ExSpirit, Nov 24, 2010 IP
  4. CSM

    CSM Active Member

    Messages:
    1,047
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    55
    #4
    Put the jQuery code into a function and call the function when after you added a new element
     
    CSM, Nov 24, 2010 IP
  5. ExSpirit

    ExSpirit Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thank you very much I think I made it now... I'll do a few more testing and hope it works now :)
     
    Last edited: Nov 24, 2010
    ExSpirit, Nov 24, 2010 IP
  6. CSM

    CSM Active Member

    Messages:
    1,047
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    55
    #6
    Okay, cool :)
     
    CSM, Nov 24, 2010 IP
  7. ExSpirit

    ExSpirit Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    CSM I hope you can help me a bit more... Because I have to many of those objects I decided to group those images and place them in DIV slider, but the problem is that all images slide away when I change tab, those on main image are not fixed but are also moved. If you can help me with that to it would be really great. I posted the basic script in this topic: forums.digitalpoint.com/showthread.php?t=2017008#post15374512
     
    ExSpirit, Nov 30, 2010 IP