Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente di HTML.it
    Registrato dal
    Mar 2011
    Messaggi
    56

    [JQUERY] Problema con Jquery Flip

    HO utlizzato questo plugin per creare una pagina portfolio clienti

    http://demo.tutorialzine.com/2010/03...y-css/demo.php


    Il problema è questo:

    Clicco sull'immagine e si ruota. Perfetto...

    Vorrei che se ho un'immagine ruotata e clicco su un'altra, la seconda si ruoti ma la prima precedentemente ruotata torni allo stato originale

    html
    <div class="sponsorListHolder">



    <div class="sponsor" title="Click to flip">
    <div class="sponsorFlip">
    [img]img/sponsors/adobe.png[/img]
    </div>

    <div class="sponsorData">
    <div class="sponsorDescription">
    Adobe
    </div>
    <div class="sponsorURL">

    </div>
    </div>
    </div>
    </div>



    javascript

    $(document).ready(function(){
    /* The following code is executed once the DOM is loaded */

    $('.sponsorFlip').bind("click",function(){

    // $(this) point to the clicked .sponsorFlip element (caching it in elem for speed):

    var elem = $(this);

    // data('flipped') is a flag we set when we flip the element:


    if(elem.data('flipped'))
    {
    // If the element has already been flipped, use the revertFlip method
    // defined by the plug-in to revert to the default state automatically:

    elem.revertFlip();

    // Unsetting the flag:
    elem.data('flipped',false)
    }
    else
    {
    // Using the flip method defined by the plugin:

    elem.flip({
    direction:'tb',
    speed: 350,
    onBefore: function(){
    // Insert the contents of the .sponsorData div (hidden from view with display:none)
    // into the clicked .sponsorFlip div before the flipping animation starts:

    elem.html(elem.siblings('.sponsorData').html());
    }
    });

    // Setting the flag:
    elem.data('flipped',true);
    }
    });

    });

  2. #2
    Utente di HTML.it L'avatar di echoweb
    Registrato dal
    Sep 2008
    Messaggi
    419
    Ti allego lo script aggiornato...

    codice:
    $(document).ready(function(){
    	/* The following code is executed once the DOM is loaded */
    	
    	$('.sponsorFlip').bind("click",function(){
    		
    		$(".sponsorFlip").each(function () {
    				var elem = $(this);
    				if(elem.data('flipped'))
    				{
    					elem.revertFlip();
    					elem.data('flipped',false)
    				}
    		});
    		
    		// $(this) point to the clicked .sponsorFlip element (caching it in elem for speed):
    		
    		var elem = $(this);
    		
    		// data('flipped') is a flag we set when we flip the element:
    		
    		if(elem.data('flipped'))
    		{
    			// If the element has already been flipped, use the revertFlip method
    			// defined by the plug-in to revert to the default state automatically:
    			
    			elem.revertFlip();
    			
    			// Unsetting the flag:
    			elem.data('flipped',false)
    		}
    		else
    		{
    			// Using the flip method defined by the plugin:
    			
    			elem.flip({
    				direction:'lr',
    				speed: 350,
    				onBefore: function(){
    					// Insert the contents of the .sponsorData div (hidden from view with display:none)
    					// into the clicked .sponsorFlip div before the flipping animation starts:
    					
    					elem.html(elem.siblings('.sponsorData').html());
    				}
    			});
    			
    			// Setting the flag:
    			elem.data('flipped',true);
    		}
    	});
    	
    });


    "Non soffocare la tua ispirazione e la tua immaginazione,
    non diventare lo schiavo del tuo modello"

    Vincent van Gogh

  3. #3
    Utente di HTML.it
    Registrato dal
    Mar 2011
    Messaggi
    56
    grazie mille!!!

    Era più semplice di quello che pensassi, come al solito mi vado a complicare la vita....

  4. #4
    Utente di HTML.it L'avatar di cassano
    Registrato dal
    Aug 2004
    Messaggi
    3,000
    MA il

    $(document).ready(function(){

    vine scatenato ad ogni postback della pagina vero ?

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 © 2024 vBulletin Solutions, Inc. All rights reserved.