Puh.. not my thing

OK, here is something to laugh :
I start with a jQuery plugin and study the plugin jCarousel . I’m at the moment not able to understand and to use the real basics from jQuery. I configure an array of pictures (this.imgarray) and would like to wrap around a link and some div’s. This is the first result :


// get to start point 
this.container = this.list.parent();
        
for (var i = 0; i < this.imgarray.length; i++) {

   this.innerHTML = &#039;<a href="'+ this.imgarray&#91;i&#93;&#91;0&#93; +'">';
   this.innerHTML += '<img />';
   this.innerHTML += '</a></div>';
        
   this.container = this.list.append(this.innerHTML).children();

}

// add the div container
this.container.wrap('<div class="ngg-gallery-thumbnail-box"></div>');
this.container.wrap('<div class="ngg-gallery-thumbnail"></div>');  

Here the result :

HTML result

Mhh, It’s ok , but  I think it’s the wrong method or to complicated. Could be easier at least… need more time to learn jQuery 😦

Tagged , , ,

4 thoughts on “Puh.. not my thing

  1. Seb says:

    Hi, i previously made a comment on the post about the 0.5 version and your logo, don’t know if you have read it .
    It’s about your logo, just check if you like it 😉
    And keep up the good work dude !
    http://alexrabe.de/2007/05/28/jump-to-version-050/

  2. alakhnor says:

    I don’t know if there is a simpler way to do it.
    The thing with jquery, is that you need to choose where you want your code to stop and where jquery takes the hand.
    And you also need to choose where to put the limit between js and php.
    Obviously, you don’t want to do all the calculation stuff under js or jquery (which would probably mean recode some php under js).
    So, then, you can choose between php and js to display a list of pics. your method is straight. You could probably have a simpler html/CSS code though 😉

    The advantage of js would be to use an ajax routine to load the pics in the background (which you can do with jcarousel).

  3. alex.rabe says:

    Yes Alakhnor, you are right.

    But my main problem is to program the DOM manipluation in a good and usefull way.

    PHP is complete different, 90% of my code works with simple IF/FOR/SWITCH statements, also to understand the core WordPress code , you didn’t need a long time, even if you are not such a good programmer.

    But have you ever follow up to understand the code of jCarousel or a other “simple” plugin ? My skills for that are very limited, maybe I can excuse my incapacity with the reason that I’m never learned programming… but it’s a pity.

  4. alakhnor says:

    Actually, I have exactly the same problem. 😉
    jquery (and js) is still something I can use but I can hardly do more…

Comments are closed.

%d bloggers like this: