I am creating a jQuery Gallery Plugin. The initial markup needed to make the plugin run is:
HTML
<div class="riGallery">
<ul>
<li><a href="http://www.example.com"><img src="img/gallery-img-1.jpg" alt="Description 1"></a></li>
<li><a href="http://www.example.com"><img src="img/gallery-img-2.jpg" alt="Description 2"></a></li>
<li><a href="http://www.example.com"><img src="img/gallery-img-3.jpg" alt="Description 3"></a></li>
</ul>
</div>
Once the plugin is called, it is dynamically adding the rest of the HTML needed to make the plugin work.
After added HTML
<div class="rigallery">
<div class="ri-display">
<a href="http://www.example.com"><img src="img/gallery-img-1.jpg" alt="Description 1"></a>
<button class="ri-prev" href="http://example.com"><</button>
<button class="ri-next">></button>
</div>
<ul>
<li><a href="http://www.example.com"><img src="img/gallery-img-1.jpg" alt="Description 1"></a></li>
<li><a href="http://www.example.com"><img src="img/gallery-img-2.jpg" alt="Description 2"></a></li>
<li><a href="http://www.example.com"><img src="img/gallery-img-3.jpg" alt="Description 3"></a></li>
</ul>
</div>
I have all of the CSS in an external stylesheet, but once I create the new elements, they don't take on the styles in the stylesheet. The stylesheet is linked up to the HTML page that the plugin is on, and I am calling the plugin after the document loads...
Plugin Call
<script>
$(function() {
$(".riGallery").riGallery({
thumbWidth: 100,
thumbHeight: 100
});
});
</script>
How do I get the CSS from the stylesheet to load on the dynamically-created elements?