for an introductory article regarding jQuery I have done the obvious
and shown how to do a slide show of pictures (nothing as fancy as
lightbox :-). The application consists of 1 HTML, 1 JavaScript and one
PHP file.
Provided, I include
<div id="liste">
<ul id="fuerbildernum"><span class="bildervorsatz">Bilder</span>
<li><a title="Bild 1 von 9 [hafen]" href="images/hafen1.jpg">1</
a></li>
...
<li><a title="Bild 9 von 9 [hafen]" href="images/hafen9.jpg">9</
a></li>
</ul>
</div>
in the HTML file it starts working just fine. But then I want to
change this list and have the a element of the picture in question
removed. Which means I change the div "liste" in order to have it look
like
...
<li><a title="Bild 3 von 9 [hafen]" href="images/hafen3.jpg">3</a></
li>
<li>4</li>
<li><a title="Bild 5 von 9 [hafen]" href="images/hafen5.jpg">5</a></
li>
...
After having generated this list a click on one of the links only has
the effect of switching to the image's page.
Does this mean that jQuery can not access a "generated" element (that
was not part of the original HTML file)? In other words, do functions
like $.getJSON() not access generated code?
The JavaScript code that generates the new links inside the ul element
looks like this
for (i = 1; i <= bdaten.serienlaenge; i++) {
if (i != bdaten.bildnr) {
listentext += '\n\t<li><a title="Bild ' + i + ' von ' +
laenge + ' [' + serie + ']" href="images/hafen' + i + '.jpg">' + i +
'</a></li>';
} else {
listentext += '\n\t<li>' + i + '</li>';
}
}
BTW If I have a list of thumbs, which I don't have to change after the
first link has been clicked everything is fine. It's only when the
links were done by a jQuery function that the second click doesn't
work...
Has anyone an idea whether this is due to jQuery's inner workings?
Best regards,
Henning
aka Madhatter ;-)
No comments:
Post a Comment