2016-03-30 7 views
-1

So blenden Sie ein effect show nach scroll n Anzahl der Pixel ein. HTML-Code ist:show div fadein nach scroll ** px mit move right to left ** px

<div class="fleft process" id="fade5" style="display:none; position: ;"> 
    <div class="dot-circle row m0"> 
     <div class="icon-circle row m0"> 
      <img src="img/analytics.png" alt="people"> 
      <div class="row m0 hover-text"> 
       Smart Ideas<br>Steady Growth 
      </div> 
     </div> 
    </div> 
    <div class="row m0">5. Analytics</div> 
</div> 

CSS-Code ist:

<style> 
    #fade5{ 
     margin-right: 50px; 
    } 
</style> 

JQuery-Code:

<script> 
$(window).bind("scroll", function() { 
    if ($(this).scrollTop() > 2100) { 
     $("#fade5").animate({right:100, opacity:"show"}, 5000); 
    } 
}); 
</script> 
+0

Ja, was Sie getan haben, ist richtig. Was ist dein Problem? –

+0

kann es nicht verblassen Effekt und auch nicht verschieben –

+0

** 1. ** Haben Sie jQuery geladen? ** 2. ** Ist Ihre Seitenhöhe mehr als '2100px'? ** 3. ** Irgendwelche Fehler in der Konsole? ** 4. ** Haben Sie dem '# fade5'' Position: relativ' oder 'Position: absolut' gegeben? –

Antwort

0

Eine bessere Möglichkeit ist CSS-Übergänge und Opazität zu verwenden. Geh runter und steig hoch. Für Demozwecke habe ich 100px Schwelle angegeben.

$(function() { 
 
    $(window).scroll(function() { 
 
    if ($(window).scrollTop() > 300) 
 
     $("#fade").addClass('on'); 
 
    else 
 
     $("#fade").removeClass('on'); 
 
    }); 
 
});
#fade { 
 
    position: fixed; 
 
    right: 0; 
 
    background: #ccf; 
 
    top: 10%; 
 
    opacity: 0; 
 
    transition: all 0.5s linear; 
 
    width: 325px; 
 
} 
 

 
#fade.on { 
 
    opacity: 1; 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<p>Pages you view in incognito tabs won’t stick around in your browser’s history, cookie store, or search history after you’ve closed all of your incognito tabs. Any files you download or bookmarks you create will be kept.</p> 
 
<p>However, you aren’t invisible. Going incognito doesn’t hide your browsing from your employer, your internet service provider, or the websites you visit.</p> 
 
<p>Pages you view in incognito tabs won’t stick around in your browser’s history, cookie store, or search history after you’ve closed all of your incognito tabs. Any files you download or bookmarks you create will be kept.</p> 
 
<p>However, you aren’t invisible. Going incognito doesn’t hide your browsing from your employer, your internet service provider, or the websites you visit.</p> 
 
<p>Pages you view in incognito tabs won’t stick around in your browser’s history, cookie store, or search history after you’ve closed all of your incognito tabs. Any files you download or bookmarks you create will be kept.</p> 
 
<p>However, you aren’t invisible. Going incognito doesn’t hide your browsing from your employer, your internet service provider, or the websites you visit.</p> 
 
<p>Pages you view in incognito tabs won’t stick around in your browser’s history, cookie store, or search history after you’ve closed all of your incognito tabs. Any files you download or bookmarks you create will be kept.</p> 
 
<p>However, you aren’t invisible. Going incognito doesn’t hide your browsing from your employer, your internet service provider, or the websites you visit.</p> 
 
<p>Pages you view in incognito tabs won’t stick around in your browser’s history, cookie store, or search history after you’ve closed all of your incognito tabs. Any files you download or bookmarks you create will be kept.</p> 
 
<p>However, you aren’t invisible. Going incognito doesn’t hide your browsing from your employer, your internet service provider, or the websites you visit.</p> 
 
<p>Pages you view in incognito tabs won’t stick around in your browser’s history, cookie store, or search history after you’ve closed all of your incognito tabs. Any files you download or bookmarks you create will be kept.</p> 
 
<p>However, you aren’t invisible. Going incognito doesn’t hide your browsing from your employer, your internet service provider, or the websites you visit.</p> 
 
<p>Pages you view in incognito tabs won’t stick around in your browser’s history, cookie store, or search history after you’ve closed all of your incognito tabs. Any files you download or bookmarks you create will be kept.</p> 
 
<p>However, you aren’t invisible. Going incognito doesn’t hide your browsing from your employer, your internet service provider, or the websites you visit.</p> 
 
<p>Pages you view in incognito tabs won’t stick around in your browser’s history, cookie store, or search history after you’ve closed all of your incognito tabs. Any files you download or bookmarks you create will be kept.</p> 
 
<p>However, you aren’t invisible. Going incognito doesn’t hide your browsing from your employer, your internet service provider, or the websites you visit.</p> 
 
<p>Pages you view in incognito tabs won’t stick around in your browser’s history, cookie store, or search history after you’ve closed all of your incognito tabs. Any files you download or bookmarks you create will be kept.</p> 
 
<p>However, you aren’t invisible. Going incognito doesn’t hide your browsing from your employer, your internet service provider, or the websites you visit.</p> 
 
<p>Pages you view in incognito tabs won’t stick around in your browser’s history, cookie store, or search history after you’ve closed all of your incognito tabs. Any files you download or bookmarks you create will be kept.</p> 
 
<p>However, you aren’t invisible. Going incognito doesn’t hide your browsing from your employer, your internet service provider, or the websites you visit.</p> 
 
<p>Pages you view in incognito tabs won’t stick around in your browser’s history, cookie store, or search history after you’ve closed all of your incognito tabs. Any files you download or bookmarks you create will be kept.</p> 
 
<p>However, you aren’t invisible. Going incognito doesn’t hide your browsing from your employer, your internet service provider, or the websites you visit.</p> 
 
<p>Pages you view in incognito tabs won’t stick around in your browser’s history, cookie store, or search history after you’ve closed all of your incognito tabs. Any files you download or bookmarks you create will be kept.</p> 
 
<p>However, you aren’t invisible. Going incognito doesn’t hide your browsing from your employer, your internet service provider, or the websites you visit.</p> 
 
<div id="fade"> 
 
    <p>Pages you view in incognito tabs won’t stick around in your browser’s history, cookie store, or search history after you’ve closed all of your incognito tabs. Any files you download or bookmarks you create will be kept.</p> 
 
    <p>However, you aren’t invisible. Going incognito doesn’t hide your browsing from your employer, your internet service provider, or the websites you visit.</p> 
 
</div>

+0

Danke Kumpel .. Ich habe wenig Veränderung in diesem .. jetzt funktioniert es .. in Verbindung treten .. –

+0

@TausifRaut Ping mich hier, wenn Sie weitere Fragen haben. Freue mich zu helfen. ':)' –

+0

Hey ich habe noch eine Frage. Wie kann ich die Opazität der Anzeige einstellen? –