Visualizzazione dei risultati da 1 a 7 su 7
  1. #1
    Utente di HTML.it
    Registrato dal
    Sep 2008
    Messaggi
    142

    modificare script lente di ingrandimento (retina)

    Ciao ragazzi, premetto che non conosco quasi affatto il javascript, sono più orientato verso php ecc... ma certe cose sono possibili solo con javascript, ad esempio l'effetto che ho ottenuto con questo script: Effetto Retina Apple

    il mio problema nasce con la necessità di inserire all'interno dell'immagine con tale effetto, un piccolo div con del testo ed un link...

    riesco ad inserirlo, ma non posso cliccare sul link in quanto mi succede una cosa del genere:


    quando entro nel div la lente non se ne va e non mi appare il mouse, quindi non poso cliccare sul link, avete qualche idea???

    ecco lo script:

    Codice PHP:
    ;(function($){
        
    /**
         * @author Ti ($.fn.retina)                [url]http://3apaxi.com/[/url]      [email]ti.bugmenot@gmail.com[/email]
         * @author Martin Angelov (idea, example)  [url]http://tutorialzine.com/2010/06/apple-like-retina-effect-jquery-css/[/url]
         * @version 0.1 (07.10.2010)
         */
        
    $.fn.retina = function(options) {
            
    options = $.extend(true, {
                
    // default options:
                
    enabletrue,         // false to deattach retina
                
    css: {},              // custom css
                
    appendTo'body',     // 
                
    srcnull,              // src of large iamge (else use rel, src or href attrs)
                
    radiusnull,          // css radius (null - auto)
                
    ie: {
                    
    css3pie'PIE.htc',  // URI of css3pie (for IE)
                    
    cursor'blank.cur' // URI of blank.cur (for IE)
                
    },
                
    preloadfalse           // preload large image?
            
    }, options)
            
            
    // attach
            
    if (options.enable) {
                
    this.each(function() {
                    if (
    this.retinathis.retina.deattach() // reattach retina
                    
    this.retina = new Retina(thisoptions.src || $(this).attr('rel') || $(this).attr('src') || $(this).attr('href'), options)
                })
            }
            
    // deattach
            
    else {
                
    this.each(function() {
                    if (
    this.retina) {
                        
    this.retina.deattach()
                        
    delete this.retina
                    
    }
                })
            }
            return 
    this
        
    }

        var 
    Retina = function(elementlargeImageoptions) {
            var 
    _this this
            
    var node = $(element)
            var 
    glass
            
    var oldIe

            
    var init = function() {
                
    oldIe = $.browser.msie && /^[5-8]\./.test($.browser.version)

                var 
    getCursor = function() {
                    if (
    oldIe && options.ie.cursor) return 'url('+options.ie.cursor+'),crosshair'
                    
    if ($.browser.mozilla || $.browser.opera) return 'none'
                    
    var blankCur 'AAACAAEAICAAAAAAAADoAgAAFgAAACgAAAAgAAAAQAAAAAEABAAAAAAAgAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD//wD/AAAA/wD/AP//AAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////w=='
                    
    if ($.browser.webkitblankCur blankCur.slice(0829)+'P'+blankCur.slice(830,1016)+'f'+blankCur.slice(1017)
                    return 
    'url(data:text/plain;base64,'+blankCur+'),none'
                
    }

                
    glass = $('<div></div>')
                
    glass.css($.extend(true, {
                    
    display'none',
                    
                    
    background'no-repeat center center white url('+largeImage+')',
                    
    border'2px solid white',
                    
                    
    /* Positioned absolutely, so we can move it around */
                    
    position'absolute',
                    
    top0,
                    
    left0,
                    
    height180,
                    
    width180,

                    
    /* CSS3 Box Shadow */
                    
    boxShadow'0 0 5px #777, 0 0 10px #aaa inset',
                    
    '-webkit-box-shadow''0 0 5px #777',
                    
    '-moz-box-shadow''0 0 5px #777, 0 0 10px #aaa inset',

                    
    cursorgetCursor()
                }, 
    options.css))
                
    glass.appendTo(options.appendTo)
        
                var 
    radius options.radius || Math.min(glass.width(),glass.height())/+'px'
                
    glass.css({
                    
    /* CSS3 rounded corners */
                    
    borderRadiusradius,
                    
    '-webkit-border-radius'radius,
                    
    '-moz-border-radius'radius
                
    })

                if (
    oldIe && options.ie.css3pieglass.css('behavior''url('+options.ie.css3pie+')')

                $(
    document).bind('mousemove'_this.move)

                
    // on load image - recalculate size
                
    node.find('img').add(node).load(_this.loadSize)
                $(
    window).resize(_this.loadSize)

                
    init = $.noop
            
    }

            var 
    offsetwidthheightglassWidthglassHeight
            _this
    .loadSize = function() {
                
    offset node.offset()
                
    width node.width()
                
    height node.height()
                
    glassWidth glass.width()
                
    glassHeight glass.height()
            }

            
    _this.show = function(e) {
                
    init()
                
    _this.loadSize()
                if (
    oldIe && options.ie.css3pieglass.show()
                else 
    glass.stop(truetrue).fadeIn('fast')
                
    _this.move(e)
            }
            
            
    _this.hide = function() {
                if (
    oldIe && options.ie.css3pieglass.hide()
                else 
    glass.stop(truetrue).fadeOut('fast')
            }
            

            
    _this.move = function(e) {
                
    // mouse out

                
    if (e.pageX offset.left || e.pageY offset.top) return _this.hide()
                if (
    offset.left width e.pageX) return _this.hide()
                if (
    offset.top height e.pageY) return _this.hide()

                
    glass.css({
                    
    // moving the retina div with the mouse
                    
    marginLefte.pageX glassWidth/2// left and top css not work in ie with css3pie!
                    
    marginTope.pageY glassHeight/2,

                    
    // scrolling the background
                    
    backgroundPosition: ( (100/width) * (e.pageX offset.left) )+'% '+( (100/height) * (e.pageY offset.top) )+'%'
                
    })
            }
            
            
    _this.deattach = function() {
                
    node.unbind('mouseenter'_this.show)
                if (
    glass) {
                    
    glass.remove()
                    $(
    document).unbind('mousemove'_this.move)
                    
    node.find('img').add(node).unbind('load'_this.loadSize)
                    $(
    window).unbind('resize'_this.loadSize)
                }
            }

            
    node.bind('mouseenter'_this.show)

            
    // preload
            
    if (options.preload) $(new Image).attr('src'largeImage)
        }
    })(
    jQuery); 

  2. #2
    Utente di HTML.it L'avatar di Xinod
    Registrato dal
    Sep 2000
    Messaggi
    13,649
    finche' il tuo div si trova (nel codice) fuori dal div id="webpage" dovrebbe disattivare l' effetto al passaggio
    ciao

  3. #3
    Utente di HTML.it
    Registrato dal
    Sep 2008
    Messaggi
    142
    non ho capito bene... devo creare un div id="webpage" al cui interno mettere l'immagine, e poi il div con il link devo metterlo al difuori di questo???

    aspetta che provo

  4. #4
    Utente di HTML.it
    Registrato dal
    Sep 2008
    Messaggi
    142
    non funziona... io una pseudo-soluzione l'ho trovata... ho sparato al div un z-index:1000 ora è cliccabile, ma un pò "antiestetico"
    male che va lo tengo così... ma una soluzione alternativa è apprezzata

  5. #5
    Utente di HTML.it L'avatar di Xinod
    Registrato dal
    Sep 2000
    Messaggi
    13,649
    io facevo riferimento allo script originale
    http://tutorialzine.com/2010/06/appl...ect-jquery-css

  6. #6
    Utente di HTML.it
    Registrato dal
    Sep 2008
    Messaggi
    142
    ora scarico quello originale e provo grazie

  7. #7
    Utente di HTML.it
    Registrato dal
    Sep 2008
    Messaggi
    142
    funziona perfetto grazie grazie

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.