/
home
/
assocoweys
/
assoco
/
modules
/
mod_resp_animate_hover
/
tmpl
/
Upload File
HOME
<?php /** * Module mod_resp_animate_hover For Joomla 2.5.x/3.0.x * Version : 2.0 * Created by : Daniel Pardons * Email : daniel.pardons@joompad.be * Created on : 21 April 2013 * Last Modified : 21 April 2013 * URL : www.joompad.be * Copyright (C) 2013 Daniel Pardons * License GPLv2.0 - http://www.gnu.org/licenses/gpl-2.0.html * Based on Animate a hover with jQuery Timothy van Sas tutorial (http://www.incg.nl/blog/2008/hover-block-jquery/) * and Wookmark plugin (http://www.wookmark.com/jquery-plugin) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // no direct access defined('_JEXEC') or die('Restricted access'); // gallery settings $gallery_bgcolor= $params->get( 'gallery_bgcolor' ); $gallery_top_margin = (int)$params->get( 'gallery_top_margin', '0' ); $gallery_bottom_margin = (int)$params->get( 'gallery_bottom_margin', '0' ); $gallery_css= $params->get( 'gallery_css' ); $item_css= $params->get( 'item_css' ); $image_width = (int)$params->get( 'image_width' ); $image_height = (int)$params->get( 'image_height' ); // floater settings $floater_margin = (int)$params->get( 'floater_margin', '0' ); // animatehover settings $gallery_sliding_effect = $params->get( 'gallery_sliding_effect' ); $sliding_effect_duration = $params->get( 'sliding_effect_duration' ); $overlay_top_offset = (int)$params->get( 'overlay_top_offset' ); /* $image_color_target = $params->get( 'image_color_target' ); $teaser_bgcolor = $params->get( 'teaser_bgcolor' ); $title_color = $params->get( 'title_color' ); $teaser_color = $params->get( 'teaser_color' ); */ $title_center = $params->get( 'title_center','0' ); $title_css = $params->get( 'title_css' ); $title_seperator = $params->get( 'title_seperator', '1' ); $teaser_padding = $params->get( 'teaser_padding' , '10' ); $teaser_center = $params->get( 'teaser_center','0' ); $teaser_css = $params->get( 'teaser_css' ); $a_css = $params->get( 'a_css' ); $title_seperator = ($title_seperator) ? '<br />' : ''; $center = ' display: block; text-align: center;'; if ($title_center) { $title_css = $title_css.$center; } if ($teaser_center) { $teaser_css = $teaser_css.$center; } $teaser_width = $image_width - 2*$teaser_padding; $teaser_height = $image_height - 2*$teaser_padding; $rahcs = ''; $rahcs .= ' #rahgallery-container'.$module->id.' { position: relative; height: 1%; display: block; zoom: 1; padding-top: '.$gallery_top_margin.'px; padding-bottom: '.$gallery_bottom_margin.'px; background-color: '.$gallery_bgcolor.'; '.$gallery_css.' }'; $rahcs .= ' #rahgallery'.$module->id.' { position: relative; width: 100%; height: 1%; display: block; zoom: 1; }'; $rahcs .= ' #rahgallery'.$module->id.' .rahitem { overflow: hidden; zoom: 1; float: left; width: '.$image_width.'px; height: '.$image_height.'px; padding: 0; margin: 0; display: none; /* wookmark */ '.$item_css.' }'; $rahcs .= ' #rahgallery'.$module->id.' a.rahteaser{ display: block; position: absolute; overflow: hidden; width: '.$teaser_width.'px; height: '.$teaser_height.'px; padding: '.$teaser_padding.'px; margin: 0 !important; top: 0; left: 0; }'; $rahcs .= ' #rahgallery'.$module->id.' div.rahteaser { position: absolute; margin: 0 !important; width: '.$teaser_width.'px; height: '.$teaser_height.'px; padding: '.$teaser_padding.'px; top: 0; left: 0; }'; $rahcs .= ' #rahgallery'.$module->id.' img.rahoverlay { margin: 0; position: absolute; top: '.$overlay_top_offset.'px; left: 0; border: 0; } '; $document = JFactory::getDocument(); $document->addStyleDeclaration($rahcs); switch ($gallery_sliding_effect) { case 1: ?> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function($) { $('#rahgallery<?php echo $module->id; ?> div.rahitem').hover(function(){ $(this).find('img.rahoverlay').animate({left:'<?php echo $image_width; ?>px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }, function(){ $(this).find('img.rahoverlay').animate({left:'0px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }); }); </script> <?php break; case 2: ?> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function($) { $('#rahgallery<?php echo $module->id; ?> div.rahitem').hover(function(){ $(this).find('img.rahoverlay').animate({top:'<?php echo $image_height; ?>px', left:'<?php echo $image_width; ?>px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }, function() { $(this).find('img.rahoverlay').animate({top:'<?php echo $overlay_top_offset; ?>px', left:'0px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }); }); </script> <?php break; case 3: ?> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function($) { $('#rahgallery<?php echo $module->id; ?> div.rahmvt1').hover(function(){ $(this).find('img.rahoverlay').animate({top:'<?php echo $image_height; ?>px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }, function(){ $(this).find('img.rahoverlay').animate({top:'<?php echo $overlay_top_offset; ?>px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }); $('#rahgallery<?php echo $module->id; ?> div.rahmvt2').hover(function(){ $(this).find('img.rahoverlay').animate({left:'<?php echo $image_width; ?>px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }, function(){ $(this).find('img.rahoverlay').animate({left:'0px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }); }); </script> <?php break; case 4: ?> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function($) { $('#rahgallery<?php echo $module->id; ?> div.rahitem').hover(function(){ $(this).find('img.rahoverlay').stop().animate({opacity: '0'}, <?php echo $sliding_effect_duration; ?>); }, function(){ $(this).find('img.rahoverlay').stop().animate({opacity: '1'}, <?php echo $sliding_effect_duration; ?>); }); }); </script> <?php break; case 5: ?> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function($) { $('#rahgallery<?php echo $module->id; ?> div.rahitem').hover(function(){ $(this).find('img.rahoverlay') .stop() .animate({opacity: '0'}, <?php echo $sliding_effect_duration; ?>) .hide(); }, function(){ $(this).find('img.rahoverlay') .stop() .show() .animate({opacity: '1'}, <?php echo $sliding_effect_duration; ?>); }); }); </script> <?php break; case 6: ?> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function($) { $('#rahgallery<?php echo $module->id; ?> div.rahitem').hover(function(){ $(this).find('img.rahoverlay').animate({left:'-<?php echo $image_width; ?>px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }, function(){ $(this).find('img.rahoverlay').animate({left:'0px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }); }); </script> <?php break; case 7: ?> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function($) { $('#rahgallery<?php echo $module->id; ?> div.rahitem').hover(function(){ $(this).find('img.rahoverlay').animate({top:'<?php echo $image_height; ?>px', left:'-<?php echo $image_width; ?>px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }, function() { $(this).find('img.rahoverlay').animate({top:'<?php echo $overlay_top_offset; ?>px', left:'0px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }); }); </script> <?php break; case 8: ?> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function($) { $('#rahgallery<?php echo $module->id; ?> div.rahmvt1').hover(function(){ $(this).find('img.rahoverlay').animate({top:'<?php echo $image_height; ?>px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }, function(){ $(this).find('img.rahoverlay').animate({top:'<?php echo $overlay_top_offset; ?>px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }); $('#rahgallery<?php echo $module->id; ?> div.rahmvt2').hover(function(){ $(this).find('img.rahoverlay').animate({left:'-<?php echo $image_width; ?>px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }, function(){ $(this).find('img.rahoverlay').animate({left:'0px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }); }); </script> <?php break; case 9: ?> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function($) { $('#rahgallery<?php echo $module->id; ?> div.rahmvt1').hover(function(){ $(this).find('img.rahoverlay').animate({top:'<?php echo $image_height; ?>px', left:'<?php echo $image_width; ?>px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }, function() { $(this).find('img.rahoverlay').animate({top:'<?php echo $overlay_top_offset; ?>px', left:'0px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }); $('#rahgallery<?php echo $module->id; ?> div.rahmvt2').hover(function(){ $(this).find('img.rahoverlay').animate({top:'<?php echo $image_height; ?>px', left:'-<?php echo $image_width; ?>px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }, function() { $(this).find('img.rahoverlay').animate({top:'<?php echo $overlay_top_offset; ?>px', left:'0px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }); }); </script> <?php break; case 0: default: ?> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function($) { $('#rahgallery<?php echo $module->id; ?> div.rahitem').hover(function(){ $(this).find('img.rahoverlay').animate({top:'<?php echo $image_height; ?>px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }, function(){ $(this).find('img.rahoverlay').animate({top:'<?php echo $overlay_top_offset; ?>px'},{queue:false,duration:<?php echo $sliding_effect_duration; ?>}); }); }); </script> <?php } ?> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function($) { $("#rahgallery<?php echo $module->id; ?> .rahitem").wookmark({ autoResize: true, container: $("#rahgallery<?php echo $module->id; ?>"), offset: <?php echo $floater_margin ?>, itemWidth: <?php echo $image_width ?> }); }); </script> <div id="rahgallery-container<?php echo $module->id;; ?>"> <div id="rahgallery<?php echo $module->id;; ?>" class="rah-gallery"> <?php $imagenr = 0; $ki = 0 ; for ($i= 1; $i <= $imgcnt; $i++) { // $cur_img = $image_ref[$imagenr] ; if ($ki) { $class = " rahmvt2"; } else { $class = " rahmvt1"; } ?> <!--galleryEntry <?php echo $imagenr+1; ?> --> <?php if ($list[$imagenr]->link) { switch ($list[$imagenr]->box_type) { case 'image': ?> <div class="rahitem<?php echo $class; ?>"> <a href="<?php echo $list[$imagenr]->link; ?>" target="<?php echo $list[$imagenr]->target; ?>"> <img src="<?php echo $list[$imagenr]->name; ?>" alt="<?php echo $list[$imagenr]->alt; ?>" /> </a> </div> <?php break; case 'caption': ?> <div class="rahitem<?php echo $class; ?>"> <a class="rahteaser" style="background:<?php echo $list[$imagenr]->bg_color; ?>; <?php echo $a_css; ?>" href="<?php echo $list[$imagenr]->link; ?>" target="<?php echo $list[$imagenr]->target; ?>"> <?php if ($list[$imagenr]->title) { ?> <span style="color:<?php echo $list[$imagenr]->title_color; ?>; <?php echo $title_css; ?>"><?php echo $list[$imagenr]->title; ?></span> <?php echo $title_seperator; } ?> <?php if ($list[$imagenr]->description) { ?> <span style="color:<?php echo $list[$imagenr]->teaser_color; ?>; <?php echo $teaser_css; ?>"><?php echo $list[$imagenr]->description; ?></span> <?php } ?> </a> </div> <?php break; case 'superposed': ?> <div class="rahitem<?php echo $class; ?>"> <img src="<?php echo $list[$imagenr]->name; ?>" alt="<?php echo $list[$imagenr]->alt; ?>" /> <a class="rahteaser" style="background:<?php echo $list[$imagenr]->bg_color; ?>; <?php echo $a_css; ?>" href="<?php echo $list[$imagenr]->link; ?>" target="<?php echo $list[$imagenr]->target; ?>"> <?php if ($list[$imagenr]->title) { ?> <span style="color:<?php echo $list[$imagenr]->title_color; ?>; <?php echo $title_css; ?>"><?php echo $list[$imagenr]->title; ?></span> <?php echo $title_seperator; } ?> <?php if ($list[$imagenr]->description) { ?> <span style="color:<?php echo $list[$imagenr]->teaser_color; ?>; <?php echo $teaser_css; ?>"><?php echo $list[$imagenr]->description; ?></span> <?php } ?> </a> </div> <?php break; case 'overlay': default: ?> <div class="rahitem<?php echo $class; ?>"> <a class="rahteaser" style="background:<?php echo $list[$imagenr]->bg_color; ?>; <?php echo $a_css; ?>" href="<?php echo $list[$imagenr]->link; ?>" target="<?php echo $list[$imagenr]->target; ?>"> <img class="rahoverlay" src="<?php echo $list[$imagenr]->name; ?>" alt="<?php echo $list[$imagenr]->alt; ?>" /> <?php if ($list[$imagenr]->title) { ?> <span style="color:<?php echo $list[$imagenr]->title_color; ?>; <?php echo $title_css; ?>"><?php echo $list[$imagenr]->title; ?></span> <?php echo $title_seperator; } ?> <?php if ($list[$imagenr]->description) { ?> <span style="color:<?php echo $list[$imagenr]->teaser_color; ?>; <?php echo $teaser_css; ?>"><?php echo $list[$imagenr]->description; ?></span> <?php } ?> </a> </div> <?php } // end switch } else { switch ($list[$imagenr]->box_type) { case 'image': ?> <div class="rahitem<?php echo $class; ?>"> <img src="<?php echo $list[$imagenr]->name; ?>" alt="<?php echo $list[$imagenr]->alt; ?>" /> </div> <?php break; case 'caption': ?> <div class="rahitem<?php echo $class; ?>"> <div class="rahteaser" style="background:<?php echo $list[$imagenr]->bg_color; ?>; <?php echo $a_css; ?>" href="<?php echo $list[$imagenr]->link; ?>" target="<?php echo $list[$imagenr]->target; ?>"> <?php if ($list[$imagenr]->title) { ?> <span style="color:<?php echo $list[$imagenr]->title_color; ?>; <?php echo $title_css; ?>"><?php echo $list[$imagenr]->title; ?></span> <?php echo $title_seperator; } ?> <?php if ($list[$imagenr]->description) { ?> <span style="color:<?php echo $list[$imagenr]->teaser_color; ?>; <?php echo $teaser_css; ?>"><?php echo $list[$imagenr]->description; ?></span> <?php } ?> </div> </div> <?php break; case 'superposed': ?> <div class="rahitem<?php echo $class; ?>"> <img src="<?php echo $list[$imagenr]->name; ?>" alt="<?php echo $list[$imagenr]->alt; ?>" /> <div class="rahteaser" style="background:<?php echo $list[$imagenr]->bg_color; ?>; <?php echo $a_css; ?>" href="<?php echo $list[$imagenr]->link; ?>" target="<?php echo $list[$imagenr]->target; ?>"> <?php if ($list[$imagenr]->title) { ?> <span style="color:<?php echo $list[$imagenr]->title_color; ?>; <?php echo $title_css; ?>"><?php echo $list[$imagenr]->title; ?></span> <?php echo $title_seperator; } ?> <?php if ($list[$imagenr]->description) { ?> <span style="color:<?php echo $list[$imagenr]->teaser_color; ?>; <?php echo $teaser_css; ?>"><?php echo $list[$imagenr]->description; ?></span> <?php } ?> </div> </div> <?php break; case 'overlay': default: ?> <div class="rahitem<?php echo $class; ?>"> <div class="rahteaser" style="background:<?php echo $list[$imagenr]->bg_color; ?>;"> <img class="rahoverlay" src="<?php echo $list[$imagenr]->name; ?>" alt="<?php echo $list[$imagenr]->alt; ?>" /> <?php if ($list[$imagenr]->title) { ?> <span style="color:<?php echo $list[$imagenr]->title_color; ?>; <?php echo $title_css; ?>"><?php echo $list[$imagenr]->title; ?></span> <?php echo $title_seperator; } ?> <?php if ($list[$imagenr]->description) { ?> <span style="color:<?php echo $list[$imagenr]->teaser_color; ?>; <?php echo $teaser_css; ?>"><?php echo $list[$imagenr]->description; ?></span> <?php } ?> </div> </div> <?php } // end switch } ?> <?php $imagenr++; $ki = 1-$ki ; } ?> </div> </div>