Jump to content
Fórum Script Brasil
  • 0

Ampliar foto fora do iframe


marvi

Question

Pessoal, tem esse efeito aqui:

http://www.outcut.de/MooFlow/example-fullsize-viewer.html

Se você ir passando a seta iria chegar a imagem de um beija-flor, e se você clicar na lupinha abaixo do beija flor, ele amplia. Só que eu fiz isso, certo, mas joguei esse efeito dentro de um iframe e o beijaflor é ampliado dentro do iframe e não fora.

Como resolver isso? Fazer ele ampliar fora do iframe?

Tentei usar esse código que uma vez deu certo para aqueles efeitos de zoom de foto tipo lightBox, mas esse tipo de script não funciona com esse efeito:

<script type="text/javascript">
    $(function() {
        $('#gallery a').lightBox();
    });
    </script>

<script>
$(function(){
    $('iframe').load(function(){
        $(this).contents().find('div#MooFlow > ul > li a').MooFlow();
    });
});
    //$('iframe').contents().find('#MooFlow > ul > li a').MooFlow();
</script>
O código da lupa / zoom é:
<script type="text/javascript">
/* MooFlow Viewer (extra JS MooFlowViewer.js)
 * v0.1dev useViewer:true
 */
MooFlow.implement({

    attachViewer: function(){
        return this;
    },
    flowStart: function(){
        this.hideIcon();
    },
    
    flowComplete: function(){
        this.createIconTip();
    },
    
    createIconTip: function(){
        var cur = this.getCurrent();
        if(!$chk(cur.rel)||!$chk(cur.href)) return;
        this.tipFx = new Fx({link:'cancel'});
        if(!$chk(this.icon)) { this.icon = new Element('a').addClass('show').setStyles({'display':'none','opacity':'0'}).inject(this.MooFlow); }
        this.icon.addEvent('click', this.onClickView.bind(this, cur));
        this.icon.addEvent('mouseenter', this.showTip.bind(this, cur));
        this.icon.addEvent('mouseleave', this.hideTip.bind(this, cur));
        if(!$chk(this.tip)){ this.tip = new Element('div').addClass('tooltip').setStyles({'display':'none','opacity':'0'}).inject(this.MooFlow); }
        this.tip.set('html', cur.alt);
        this.icon.addClass(cur.rel.toLowerCase());
        this.icon.setStyle('display','block').fade(0.6);
    },

    showTip: function(cur){
        this.tip.setStyles({'top':100,'display':'block'});
        this.tipFx = new Fx.Morph(this.tip,{link:'cancel'}).start({'opacity': 0.8, 'top': this.icon.getCoordinates().top-this.tip.getSize().y-100});
    },
    
    hideTip: function(cur){
        this.tipFx.start({'opacity': 0, 'top': 100});
    },

    hideIcon: function(){
        if($chk(this.icon) && $chk(this.icon.getParent())) this.icon.destroy();
        if($chk(this.tip) && $chk(this.tip.getParent())) this.tip.destroy();
        this.icon = this.tip = null;    
    },
    
    onClickView: function(cur){
        switch (cur.rel.toLowerCase()){
            case 'image':
            this.loadImage(cur);
            break;
            case 'link':
            window.open(cur.href, cur.target || '_parent');
            break;
            default:
        }
    },
    
    loadImage: function(cur){
        this.icon.removeClass('image').addClass('viewerload');
        this.image = new Asset.image(cur.href, {onload: this.showImage.bind(this)});
    },
    
    showImage: function(){
        var cur = this.getCurrent();
        var c = cur.con.getFirst().getCoordinates();
        this.image.inject(document.body);
        this.image.addEvent('click', this.hideImage.bind(this));
        this.image.setStyles({'left':c.left,'top':c.top,'width':c.width,'height':c.height,'position':'absolute','z-index':'103'});
        var imageFx = new Fx.Morph(this.image, {transition: Fx.Transitions.Sine.easeOut});
        var to = {x: this.image.get('width'), y: this.image.get('height')};
        var box = document.getSize(), scroll = document.getScroll();
        var pos = {x: scroll.x + ((box.x - to.x) / 2).toInt(), y: scroll.y + ((box.y - to.y) / 2).toInt() };
        var vars = {left: pos.x, top: pos.y, width: to.x, height: to.y};
        imageFx.start(vars);
    },
    
    hideImage: function(){
        this.icon.removeClass('viewerload').addClass('image');
        this.image.dispose();
    }
});
</script>
A página é:
<div id="content">
    <div id="MooFlow" >
        <a href="http://www.apple.de" rel="link">
        <img src="applelogo.jpg"  alt="oiii" width="240" height="160" /></a>
        <a href="http://www.apple.com" rel="link">
        <img src="shinny-logo.jpg" title="Apple US" alt="Visit www.apple.com" width="200" height="200" /></a>
        <a target="_parent" href="macbook_pro2.jpg" rel="image">
        <img src="macbook_pro2.jpg" title="MacBook Pro" alt="Pure Schönheit. Pure Leistung." width="320" height="180" /></a>
        <a target="_parent" href="macpro.jpg" rel="image">
        <img src="macpro.jpg" title="Mac Pro" alt="Der neue 8-Core Standard." width="240" height="250" /></a>
        <a target="_parent" href="macbook_air.jpg" rel="image">
        <img src="macbook_air.jpg" title="MacBook Air" alt="Das dünnste Notebook der Welt." width="300" height="200" /></a>
    </div>

Tem como resolve isso?

Eu agradeço muito!

Edited by Jonathan Queiroz
Link to post
Share on other sites

4 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      149408
    • Total Posts
      645898
×
×
  • Create New...