Ir para conteúdo
Fórum Script Brasil
  • 0

Slideshow com link


streme

Pergunta

Oláa todos, estou com um projeto no qual o template do site possui um slideshow, mas um mesmo não apresenta nenhuma opção de inserção de link, ou seja, ele mostra um slideshow mas ao clicar nas imagens não leva a lugar nenhuma, e eu desejava que ao clicar na imagem o user fosse levado a um caminho de minha preferencia.

já tentei diversos modos e os mesmo so dão erros. alguém pode me ajudar como fazer o slideshow com um linkpor favor?

para saberem como funciona o slideshow podem visualizar direto no site ainda em construção http://portal.rendersbrasil.com.br

código do arquivo slideshow.js

var SlideShow = new Class({
    
    getOptions: function(){
        return {
            effect: 'fade', //fade|wipe|slide|random
            duration: 2000,
            transition: Fx.Transitions.linear,
            direction: 'right', //top|right|bottom|left|random
            color: false,
            wait: 5000,
            loop: false,
            thumbnails: false,
            thumbnailCls: 'outline',
            backgroundSlider: false,
            loadingCls: 'loading',
            onClick: false
        };
    },

    initialize: function(container, images, options){
        this.setOptions(this.getOptions(), options);
        
        this.container = $(container);
        this.container.setStyles({
            position: 'relative',
            overflow: 'hidden'
        });
        if(this.options.onClick){
            this.container.addEvent('click', function(){
                this.options.onClick(this.imageLoaded);
            }.bind(this));
        }
        
        
        this.imagesHolder = new Element('div').setStyles({
            position: 'absolute',
            overflow: 'hidden',
            top: this.container.getStyle('height'),
            left: 0,
            width: '0px',
            height: '0px',
            display: 'none'
        }).injectInside(this.container);
        
        if($type(images) == 'string' && !this.options.thumbnails){
            var imageList = [];
            $$('.'+images).each(function(el){
                imageList.push(el.src);
                el.injectInside(this.imagesHolder);
            },this);
            this.images = imageList;
            
        }else if($type(images) == 'string' && this.options.thumbnails){
            var imageList = [];
            var srcList = [];
            this.thumbnails = $$('.'+images);
            this.thumbnails.each(function(el,i){
                srcList.push(el.href);
                imageList.push(el.getElement('img'));
                el.href = 'java script:;';
                el.addEvent('click',function(){
                    this.stop();
                    this.play(i);                 
                }.bind(this,el,i));
            },this);
            this.images = srcList;
            this.thumbnailImages = imageList;
            
            if(this.options.backgroundSlider){
                this.bgSlider = new BackgroundSlider(this.thumbnailImages,{mouseOver: false, duration: this.options.duration, className: this.options.thumbnailCls, padding:{top:0,right:-2,bottom:-2,left:0}});
                this.bgSlider.set(this.thumbnailImages[0]);
            }
        
        }else{
            this.images = images;
        }
        
        this.loading = new Element('div').addClass(this.options.loadingCls).setStyles({
            position: 'absolute',
            top: 0,
            left: 0,
            zIndex: 3,
            display: 'none',
            width: this.container.getStyle('width'),
            height: this.container.getStyle('height')
        }).injectInside(this.container);
        
        this.oldImage = new Element('div').setStyles({
            position: 'absolute',
            overflow: 'hidden',
            top: 0,
            left: 0,
            opacity: 0,
            width: this.container.getStyle('width'),
            height: this.container.getStyle('height')
        }).injectInside(this.container);
        
        this.newImage = this.oldImage.clone();
        this.newImage.injectInside(this.container);
        
        
        
        this.timer = 0;
        this.image = -1;
        this.imageLoaded = 0;
        this.stopped = true;
        this.started = false;
        this.animating = false;
    },
    
    load: function(){
        $clear(this.timer);
        this.loading.setStyle('display','block');
        this.image++;
        var img = this.images[this.image];
        delete this.imageObj;
        
        doLoad = true;
        this.imagesHolder.getElements('img').each(function(el){
            var src = this.images[this.image];
            if(el.src == src){
                this.imageObj = el;
                doLoad = false;
                this.add = false;
                this.show();
            }
        },this);
        
        if(doLoad){
            this.add = true;
            this.imageObj = new Asset.image(img, {onload: this.show.bind(this)});
        }
        
    },

    show: function(add){
        
        if(this.add){
            this.imageObj.injectInside(this.imagesHolder);
        }
        
        this.newImage.setStyles({
            zIndex: 1,
            opacity: 0
        });
        var img = this.newImage.getElement('img');
        if(img){
            img.replaceWith(this.imageObj.clone());
        }else{
            var obj = this.imageObj.clone();
            obj.injectInside(this.newImage);
        }
        this.imageLoaded = this.image;
        this.loading.setStyle('display','none');
        if(this.options.thumbnails){
            
            if(this.options.backgroundSlider){
                var elT = this.thumbnailImages[this.image];
                this.bgSlider.move(elT);
                this.bgSlider.setStart(elT);
            }else{
                this.thumbnails.each(function(el,i){
                    el.removeClass(this.options.thumbnailCls);
                    if(i == this.image){
                        el.addClass(this.options.thumbnailCls);
                    }
                },this);
            }
        }
        this.effect();
    },
    
    wait: function(){
        this.timer = this.load.delay(this.options.wait,this);
    },
    
    play: function(num){
        if(this.stopped){
            if(num > -1){this.image = num-1};
            if(this.image < this.images.length){
                this.stopped = false;
                if(this.started){
                    this.next();
                }else{
                    this.load();
                }
                this.started = true;
            }
        }
    },
    
    stop: function(){
        $clear(this.timer);
        this.stopped = true;
    },
    
    next: function(wait){
        var doNext = true;
        if(wait && this.stopped){
            doNext = false;
        }
        if(this.animating){
            doNext = false;
        }
        if(doNext){
            this.cloneImage();
            $clear(this.timer);
            if(this.image < this.images.length-1){
                if(wait){
                    this.wait();
                }else{
                    this.load();    
                }
            }else{
                if(this.options.loop){
                    this.image = -1;
                    if(wait){
                        this.wait();
                    }else{
                        this.load();    
                    }
                }else{
                    this.stopped = true;
                }
            }
        }
    },
    
    previous: function(){
        if(this.imageLoaded == 0){
            this.image = this.images.length-2;    
        }else{
            this.image = this.imageLoaded-2;
        }
        this.next();
    },
    
    cloneImage: function(){
        var img = this.oldImage.getElement('img');
        if(img){
            img.replaceWith(this.imageObj.clone());
        }else{
            var obj = this.imageObj.clone();
            obj.injectInside(this.oldImage);
        }
        
        this.oldImage.setStyles({
            zIndex: 0,
            top: 0,
            left: 0,
            opacity: 1
        });
        
        this.newImage.setStyles({opacity:0});
    },
    
    
    effect: function(){
        this.animating = true;
        this.effectObj = this.newImage.effects({
            duration: this.options.duration,
            transition: this.options.transition
        });
        
        var myFxTypes = ['fade','wipe','slide'];
        var myFxDir = ['top','right','bottom','left'];
        
        if(this.options.effect == 'fade'){
            this.fade();
            
        }else if(this.options.effect == 'wipe'){
            if(this.options.direction == 'random'){
                this.setup(myFxDir[Math.floor(Math.random()*(3+1))]);
            }else{
                this.setup(this.options.direction);
            }
            this.wipe();
            
        }else if(this.options.effect == 'slide'){
            if(this.options.direction == 'random'){
                this.setup(myFxDir[Math.floor(Math.random()*(3+1))]);
            }else{
                this.setup(this.options.direction);
            }
            this.slide();
            
        }else if(this.options.effect == 'random'){
            var type = myFxTypes[Math.floor(Math.random()*(2+1))];
            if(type != 'fade'){
                var dir = myFxDir[Math.floor(Math.random()*(3+1))];
                if(this.options.direction == 'random'){
                    this.setup(dir);
                }else{
                    this.setup(this.options.direction);
                }
            }else{
                this.setup();
            }
            this[type]();
        }
    },
    
    setup: function(dir){
        if(dir == 'top'){
            this.top = -this.container.getStyle('height').toInt();
            this.left = 0;
            this.topOut = this.container.getStyle('height').toInt();
            this.leftOut = 0;
            
        }else if(dir == 'right'){
            this.top = 0;
            this.left = this.container.getStyle('width').toInt();
            this.topOut = 0;
            this.leftOut = -this.container.getStyle('width').toInt();
            
        }else if(dir == 'bottom'){
            this.top = this.container.getStyle('height').toInt();
            this.left = 0;
            this.topOut = -this.container.getStyle('height').toInt();
            this.leftOut = 0;
            
        }else if(dir == 'left'){
            this.top = 0;
            this.left = -this.container.getStyle('width').toInt();
            this.topOut = 0;
            this.leftOut = this.container.getStyle('width').toInt();
            
        }else{
            this.top = 0;
            this.left = 0;
            this.topOut = 0;
            this.leftOut = 0;
        }
    },
    
    fade: function(){
        this.effectObj.start({
            opacity: [0,1]
        });
        this.resetAnimation.delay(this.options.duration+90,this);
        if(!this.stopped){
        this.next.delay(this.options.duration+100,this,true);
        }
    },
    
    wipe: function(){
        this.oldImage.effects({
            duration: this.options.duration,
            transition: this.options.transition
        }).start({
            top: [0,this.topOut],
            left: [0, this.leftOut]
        })
        this.effectObj.start({
            top: [this.top,0],
            left: [this.left,0],
            opacity: [1,1]
        },this);
        this.resetAnimation.delay(this.options.duration+90,this);
        if(!this.stopped){
        this.next.delay(this.options.duration+100,this,true);
        }
    },
    
    slide: function(){
        this.effectObj.start({
            top: [this.top,0],
            left: [this.left,0],
            opacity: [1,1]
        },this);
        this.resetAnimation.delay(this.options.duration+90,this);
        if(!this.stopped){
        this.next.delay(this.options.duration+100,this,true);
        }
    },
    
    resetAnimation: function(){
        this.animating = false;
    }
    
});
SlideShow.implement(new Options);
SlideShow.implement(new Events);


/*************************************************************/
codigo da pagina index.php (a pagina que apresenta o slideshow)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language ?>" dir="<?php echo $this->direction; ?>">
<head>
<jdoc:include type="head" />
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.mootools');
?>
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/general.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/template_<?php echo $this->params->get('color'); ?>.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/slideshow_<?php echo $this->params->get('color'); ?>.css" type="text/css" />
&lt;script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/slideshow.js"></script>
&lt;script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/backgroundslider.js"></script>
&lt;script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/hover.js"></script>
</head>
<body >
<div id="body_inner">
    <div id="user3">
        <div id="user3_inner">
            <jdoc:include type="modules" name="user3" />
        </div>
    </div>
    <div id="content">
        <div id="slideshow_outer">
            <div id="slideshow">
                <div id="slideshowContainer" class="slideshowContainer"></div>
                <div id="thumbnails">
                    <div class="thumb_left">
                        <div class="slideshowThumbnail_a"><a href="<?php echo $this->baseurl ?>/templates/nld_050_1.5/images/slideshow/image1.jpg" class="slideshowThumbnail"><span class="slideshowThumbnail_image"><img src="<?php echo $this->baseurl ?>/templates/nld_050_1.5/images/slideshow/mini1.jpg" border="0" height="70" width="100" alt="" title="" /></span><span class="slideshow_title_text"><span class="slideshow_title"><?php echo $this->params->get('title1'); ?></span><span class="slideshow_text"><?php echo $this->params->get('text1'); ?></span></span></a></div>
                        <div class="slideshowThumbnail_a"><a href="<?php echo $this->baseurl ?>/templates/nld_050_1.5/images/slideshow/image2.jpg" class="slideshowThumbnail"><span class="slideshowThumbnail_image"><img src="<?php echo $this->baseurl ?>/templates/nld_050_1.5/images/slideshow/mini2.jpg" border="0" height="70" width="100" alt="" title="" /></span><span class="slideshow_title_text"><span class="slideshow_title"><?php echo $this->params->get('title2'); ?></span><span class="slideshow_text"><?php echo $this->params->get('text2'); ?></span></span></a></div>
                        <div class="slideshowThumbnail_a"><a href="<?php echo $this->baseurl ?>/templates/nld_050_1.5/images/slideshow/image3.jpg" class="slideshowThumbnail"><span class="slideshowThumbnail_image"><img src="<?php echo $this->baseurl ?>/templates/nld_050_1.5/images/slideshow/mini3.jpg" border="0" height="70" width="100" alt="" title="" /></span><span class="slideshow_title_text"><span class="slideshow_title"><?php echo $this->params->get('title3'); ?></span><span class="slideshow_text"><?php echo $this->params->get('text3'); ?></span></span></a></div>
                    </div>
                    <div class="thumb_right">
                        <div class="slideshowThumbnail_a"><a href="<?php echo $this->baseurl ?>/templates/nld_050_1.5/images/slideshow/image4.jpg" class="slideshowThumbnail"><span class="slideshowThumbnail_image"><img src="<?php echo $this->baseurl ?>/templates/nld_050_1.5/images/slideshow/mini4.jpg" border="0" height="70" width="100" alt="" title="" /></span><span class="slideshow_title_text"><span class="slideshow_title"><?php echo $this->params->get('title4'); ?></span><span class="slideshow_text"><?php echo $this->params->get('text4'); ?></span></span></a></div>
                        <div class="slideshowThumbnail_a"><a href="<?php echo $this->baseurl ?>/templates/nld_050_1.5/images/slideshow/image5.jpg" class="slideshowThumbnail"><span class="slideshowThumbnail_image"><img src="<?php echo $this->baseurl ?>/templates/nld_050_1.5/images/slideshow/mini5.jpg" border="0" height="70" width="100" alt="" title="" /></span><span class="slideshow_title_text"><span class="slideshow_title"><?php echo $this->params->get('title5'); ?></span><span class="slideshow_text"><?php echo $this->params->get('text5'); ?></span></span></a></div>
                        <div class="slideshowThumbnail_a"><a href="<?php echo $this->baseurl ?>/templates/nld_050_1.5/images/slideshow/image6.jpg" class="slideshowThumbnail"><span class="slideshowThumbnail_image"><img src="<?php echo $this->baseurl ?>/templates/nld_050_1.5/images/slideshow/mini6.jpg" border="0" height="70" width="100" alt="" title="" /></span><span class="slideshow_title_text"><span class="slideshow_title"><?php echo $this->params->get('title6'); ?></span><span class="slideshow_text"><?php echo $this->params->get('text6'); ?></span></span></a></div>
                    </div>
                </div>
                    &lt;script type="text/javascript">
                        window.addEvent('domready',function(){
                            var obj = {
                                wait: 3000, 
                                effect: 'fade',
                                duration: 1000, 
                                loop: true, 
                                thumbnails: true,
                                backgroundSlider: true,
                                onClick: function(i){alert(i)}
                            }
                            show = new SlideShow('slideshowContainer','slideshowThumbnail',obj);
                            show.play();
                        });
                  </script>
            </div>
        </div>
        <?php if($this->params->get('left_component_right') == 'left') : ?>
            <div id="left_component">
                <div id="left_outer">
                    <div id="left">
                        <jdoc:include type="modules" name="left" style="nldmod_left" />
                    </div>
                </div>
                <div id="component_outer_left">
                    <div id="pathway">
                        <jdoc:include type="modules" name="breadcrumb" />
                    </div>
                    <div id="component_left">
                        <div id="component_inner">
                            <jdoc:include type="component" />
                        </div>
                    </div>
                </div>
            </div>
        <?php endif; ?>
        <?php if($this->params->get('left_component_right') == 'right') : ?>
            <div id="right_component">
                <div id="right_outer">
                    <div id="right">
                        <jdoc:include type="modules" name="right" style="nldmod_left" />
                    </div>
                </div>
                <div id="component_outer_right">
                    <div id="pathway">
                        <jdoc:include type="modules" name="breadcrumb" />
                    </div>
                    <div id="component_right">
                        <div id="component_inner">
                            <jdoc:include type="component" />
                        </div>
                    </div>
                </div>
            </div>
        <?php endif; ?>
    </div>
    <div id="bottom">
        <div id="bottom_inner">
            <div id="phatfusion">
                <?php if($this->params->get('slideshow_powered_by')) : ?>
                    Renders Brasil 2010 - Todos os direitos reservados ©
                <?php endif; ?>
            </div>
            <div id="copy">
<!-- RESPEKTIEREN SIE DIE ARBEIT VON DEM DESIGNER -->    
<!-- RESPECT THE WORK FROM THE DESIGNER -->    
<!-- CC - Attribution-Share Alike 3.0 Unported - Do not remove Designlink!Den Designlink nicht entfernen!Euro 9,90 via PayPal contact@next-level-design.de - CC - Attribution-Share Alike 3.0 Unported -->    
                Design by Next Level Design / Script by Joomla! 
<!-- CC - Attribution-Share Alike 3.0 Unported - Do not remove Designlink!Den Designlink nicht entfernen!Euro 9,90 via PayPal contact@next-level-design.de - CC - Attribution-Share Alike 3.0 Unported -->    
<!-- RESPEKTIEREN SIE DIE ARBEIT VON DEM DESIGNER -->    
<!-- RESPECT THE WORK FROM THE DESIGNER -->
            </div>
        </div>
    </div>        
</div>
<div>
<jdoc:include type="module" name="debug" style="-1" />
</div>
</body>
</html>

Link para o comentário
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,3k
×
×
  • Criar Novo...