Skip to content
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

insertSlide/removeSlide functions? #41

Closed
mtakemiya opened this issue Oct 16, 2013 · 9 comments
Closed

insertSlide/removeSlide functions? #41

mtakemiya opened this issue Oct 16, 2013 · 9 comments

Comments

@mtakemiya
Copy link

Is it possible to easily added functions to allow slides to be inserted and removed at an index? It would be really great to add/remove content dynamically.

@alvarotrigo
Copy link
Owner

It is not possible right now.
What you could do right now is creating the slides and then adding content to them dynamically but I understand that's not what you are looking for.

I will think about it!

@ghost
Copy link

ghost commented Dec 19, 2013

This would be absolutely great if something like this could happen - I've been trying to get something going but of course the translate 3d jumps to the next slide if you remove one above it.

Not sure if you remember my site - I was using one of your earliest versions and you answered on stackoverflow - anyway I've finally had time to go back to it, implemented the newest version and absolutely loving it. Either a way to remove the initial div (my splash page) or stop a user scrolling to a certain section, either would work. If you want to have a look at what I mean - bnacademy.com.au

Keep up the amazing work 👍

@Necmttn
Copy link

Necmttn commented Jan 20, 2014

XsitX Your totally right, i also need something like that, i want to keep people in the first page until page load finish,
you can check out karmaffne.com it's almost 13mb webpage sometimes it's take time to finish load. if i can keep people in the first page until intro finish it's will be great. 👍

@alvarotrigo
Copy link
Owner

it's almost 13mb webpage sometimes it's take time to finish load. if i can keep people in the first page until intro finish it's will be great.

In order to do so you don't need to use AJAX or dynamically add new sections/slides.
You could make use of callbacks for that.
In this comment I explained how to do it with images but you can also apply it to anything else by loading it with jQuery using afterLoad, for example.

@Necmttn
Copy link

Necmttn commented Jan 20, 2014

but for my website, karmaffne.com there is have maybe 450 small pictures and those pictures call with other jquery script i can't use afterLoad trick i guess.. 🎱

@ghost
Copy link

ghost commented Jan 20, 2014

Ive handled the keeping people on the splash page by disabling scroll and arrow navigation until they click the 'begin' button, which only appears after everything has loaded.
As for the removing of slides, my design changed and I no longer need to do that, but the issue I had is that if you removed a slide using afterLoad or onLeave then the slides would jump one down, because one above it was removed. I dont need that solved or anything but that was initially my issue.

@painis
Copy link

painis commented Jan 20, 2014

Ok i found a solution that works fine for me.

I named the sections id "section_anchorName" and added a data attribute to the slides that should be loaded later called data-url to store the url.

  • onSlideLeave to preload the next slide
  • afterSlideLoad to load the slide if its called direct via url #section/slide
  • afterRender to add a class (in my case loading) to all slides with data-url
onSlideLeave: function(anchorLink, index, slideIndex, direction){
    var next_slide_index;

    if(direction == 'right'){
        next_slide_index = slideIndex + 1;
    } else {
        next_slide_index = slideIndex - 1;
    }

    var next_slide = $('#section_'+anchorLink).find('.slide').eq(next_slide_index);

    if(next_slide.length && next_slide.data('url') && !next_slide.data('loaded')) {
        next_slide.find('.tableCell').load(next_slide.data('url'), function() {
            next_slide.removeClass('loading').data('loaded',true);
        });
    }
},
afterSlideLoad: function( anchorLink, index, slideAnchor, slideIndex){
    var slide = $('#section_'+anchorLink).find('.slide').eq(slideIndex);

    if(slide.length && slide.data('url') && !slide.data('loaded')) {
        slide.find('.tableCell').load(slide.data('url'), function() {
            slide.removeClass('loading').data('loaded',true);
        });
    }
},
afterRender: function() {
    $('[data-url]').addClass('loading');
}

I know it's not really a dynamic adding of slides but it helps you to keep the traffic low by loading the slices when they are needed.

@alvarotrigo
Copy link
Owner

@painis just be careful with loading data into the section dynamically. You will probably have problems if you are using the option scrollOverflow. The feature won't work correctly with those slides.

If you are just avoiding the load of background images, I would recommend dealing with CSS to solve the problem.

@alvarotrigo
Copy link
Owner

The feature of adding or deleting sections won't be done.
Content can be loaded into them by using callbacks and AJAX. Also, now a function reBuild is available to solve problems with things such as scrollOverflow.

A future function to avoid scrolling right or left, up or down, might be created so you will be able to have empty sections / slides which would be able to be filled with content whenever you want.

This way, although the addition or deletion of sections or slides won't be implemented, the same behavior for the final user could be accomplish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants