WordPress.org

Forums

FancyBox
SUGGESTION: Class vs Rel Attribute for Image Grouping (2 posts)

  1. Brian
    Member
    Posted 3 years ago #

    Great plugin. I've used it with a lot of my sites.

    But I recently came across an issue with grouping image, specifically with the plugin's use of the rel attribute instead of relying on a class.

    My problem was that the plugin is using rel="fancybox" to fire Fancybox, which was over-writing the rel="group1", rel="group2", etc. in my image links and breaking the groups.

    In future updates, can you substitute "class" for your "rel" attribute? or is there a reason you decided to go with rel?

    http://wordpress.org/extend/plugins/fancy-box/

  2. lwinglewich
    Member
    Posted 2 years ago #

    If you open fancybox.php and change

    <script type="text/javascript">
    	jQuery(document).ready(function($){
    		var select = $('a[href$=".bmp"],a[href$=".gif"],a[href$=".jpg"],a[href$=".jpeg"],a[href$=".png"],a[href$=".BMP"],a[href$=".GIF"],a[href$=".JPG"],a[href$=".JPEG"],a[href$=".PNG"]');
    		select.attr('rel', 'fancybox');
    		select.fancybox();
    
    	});
    </script>

    to

    <script type="text/javascript">
    	jQuery(document).ready(function($){
    		var select = $('a.className');
    		select.fancybox();
    	});
    </script>

    you'll be able to group them into a slideshow by setting the rel attribute and you can set your own class by changing 'className'

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • FancyBox
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags