-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
load image after show #153
Comments
Take a look at this solution If you still want to use Lazy Load plugin, I would recommend you to ask on its github issues forum as I don´t personally know how it works. If you are using fullpage with the |
I had problems with lazy load, too, so I created this workaround (lazy load no more needed!): 1.) Inside your images replace attribute src="whatever.jpg" with data-original="whatever.jpg" 2.) Add following events inside fullpage script: $('#yourFullPageContainer').fullpage({
onLeave: function(index, direction){},
afterLoad: function(anchorLink, index){
var activeSection = $('.section').eq(index -1);
activeSection.find('img').each(function() {
var imagePath = $(this).attr("data-original");
$(this).attr('src',imagePath);
});
},
afterRender: function(){
var activeSection = $('.section').eq(0);;
activeSection.find('img').each(function() {
var imagePath = $(this).attr("data-original");
$(this).attr('src',imagePath);
});
}
}); |
Yeah, exactly. That's a very similar principle to the solution I proposed in this topic. That's the way to do it with this plugin. Using callbacks. Lazy load plugins usually use the positions of the elements in the viewport together with the |
Yep, but I needed a solution that works with image tags inside my HTML. :-) |
Yeah, and that's a way to do it. |
Hi @Janosch7384 Your solution works (that's awesome), but somehow it effects the scrollOverflow option. It's just like as if I set the scrollOverflow 'false'. Any idea? @alvarotrigo maybe? :) Here's the code: $('#fullpage').fullpage({
//Navigation
menu: true,
anchors:['firstSlide', 'secondSlide', 'thirdSlide', 'fourthSlide', 'fifthSlide', 'sixthSlide', 'seventhSlide'],
navigation: true,
navigationPosition: 'right',
navigationTooltips: ['firstSlide', 'secondSlide', 'thirdSlide', 'fourthSlide', 'fifthSlide', 'sixthSlide', 'seventhSlide'],
//Scrolling
css3: true,
scrollingSpeed: 300,
autoScrolling: true,
easing: 'easeInQuart',
easingcss3: 'ease',
loopBottom: false,
loopTop: false,
loopHorizontal: true,
continuousVertical: false,
normalScrollElements: '#element1, .element2',
scrollOverflow: true,
touchSensitivity: 15,
normalScrollElementTouchThreshold: 5,
//Design
verticalCentered: true,
resize: false,
sectionsColor : ['#ccc', '#fff'],
paddingTop: '4em',
responsive: 0,
//Events
onLeave: function(anchorLink, index){
if(index == 1,2,3,4,5,6){
$("footer").slideUp(250);
}
},
afterLoad: function(anchorLink, index){
if(index == 7){
$(".section").length && $("footer").slideDown(500);
}
var activeSection = $('.section').eq(index -1);
activeSection.find('img').each(function() {
var imagePath = $(this).attr("data-original");
$(this).attr('src',imagePath);
});
},
afterRender: function(){
var activeSection = $('.section').eq(0);;
activeSection.find('img').each(function() {
var imagePath = $(this).attr("data-original");
$(this).attr('src',imagePath);
});
}
}); |
@nugjagoan Set the size of the image before loading the image. That way fullPage.js will create the scrollbar before you load the images. Otherwise you would have to use |
Thanks for fast reply @alvarotrigo :) Solution #1: I'm sorry I don't understand, you mean I have to apply the width and height for each img? I have uploaded my work, please kindly take a look it here: http://tokobayifika.com/test/index.htm Thank you very much :) |
Use the |
Done: http://tokobayifika.com/test/index.htm But still, jumping to next section without scrolling down on a long content. Please advice :) |
Not sure whats going on, it might be because you are using |
I see. How should I use it? Put it after above code like this? $('#fullpage').fullpage({
// ABOVE CODE
});
$.fn.fullpage.reBuild(); |
No, on the callback after you load the images. |
It works! Thank you! |
Lazy loading has been implemented in fullPage.js 2.6.6. |
i used full page js in my website. if i reloading my website it seems like this (https://abc.html/#sectionfour) .I want https://abc.html like this only after reloading is there any way to overcome this.. |
$("#fullpage").fullpage({ |
its not working...... |
Hi,
How can i use load image like lazy load after image show
i used lazy load but not work correctly
please give me suggestion.
thanks
The text was updated successfully, but these errors were encountered: