[Plugin: Easy FancyBox] Applying Fancybox class to elements using jquery
-
I recently decided to use HungryFEED to display some news feeds on a site I am creating. As I already used Easy Fancybox to provide effects for galleries and external links, I thought I could do the same for the links of the news feed articles.
As HungryFEED just provides a way to reformat an already formatted feed, the ‘a’ tags classes have to be changed to include the ‘fancybox iframe’ class.
I have found a way to do it using jquery in the custom CSS code of HungryFEED (with the kind help of the creator of course):<script type="text/javascript"> jQuery(document).ready(function($) { $('.hungryfeed_item a').attr("target", "_blank"); $('.hungryfeed_item a').addClass("fancybox iframe {width:930,height:680}"); }); </script>
The change of target attribute works fine, but the class addition does not make the link open in a fancybox iframe as I thought it would.
I suspect it is because the class must be declared in the creation of the link, and not applied afterwards dynamically using jquery.
Is my suspicion correct? Or there is something else/more that I am missing in this case?
I am not an experienced html/php/script programmer so I could use some help. Using fancybox to present feed links with the formating options that HungryFEED is giving, is going to be a very effective combination.
- The topic ‘[Plugin: Easy FancyBox] Applying Fancybox class to elements using jquery’ is closed to new replies.