How to make github style page transitions by pjax - javascript

Once a time, I read an article said that github page transition is made by pjax, I checked jquery-pjax project. I think I have close to the answer, it must be something related with event pjax:start and pjax:end, but I still can't get it works, so I try to get some help here.
$('a.pjax').pjax('#main');
$('#main').bind('pjax:start', function(){$('#main').slideUp()})
.bind('pjax:end'), function(){$('#main').slideDown()});
But it has no effects

Github use HTML5 features for the page transitions. That includes the new JS History API and CSS3 transitions. No jQuery involved except for standard event listening, selectors. The blog post is here with all the relevant links
https://github.com/blog/760-the-tree-slider

I don't know if this is relevant at all. But I've been using Pjax myself and the code above has a syntax error, should be:
$('a.pjax').pjax('#main');
$('#main').bind('pjax:start', function(){$('#main').slideUp()})
.bind('pjax:end', function(){$('#main').slideDown()});
Edit: Yes, sorry for not pointing that out. Exactly as #Udo Held said: You need to remove the bracket after 'pjax:end' or else it will not follow through and execute the $('#main').slideDown() function.

Pjax : Demo , Source[Github] It is the one that
github use.. reference

Related

interact.js drag/drop referencing div

So, this is maybe just a question for interact.js users or I am missing something completely..
I was looking for a javascript library that provides me with drag/drop/scale/rotate and touch functionality for all those given functionalities. So, I stumbled upon interact.js, yet I seem to have a problem referencing elements while using the onDrop method:
I'll just take the code of the interact.js page, which I'm providing you here: http://jsfiddle.net/Zyy2N/2/
The part that is making problems is:
$(event.relatedTarget.id).hide();
which doesn't do anything, yet also doesn't throw any errors. More so:
$('#yes-drop').hide();
works, so does:
console.log(event.relatedTarget.id);
which returns the id as expected. Is this an error?
Solution: One should actually use the correct syntax if one wants code to run correctly...
$('#'+event.relatedTarget.id).hide();
This would actually be a correct and working solution :
http://jsfiddle.net/Zyy2N/3/
Sligthly better:
$(event.relatedTarget).hide();
http://jsfiddle.net/Zyy2N/8/

Get a style switcher like on themeforest

I would like to add a style switcher to my site and I like the ones used on themeforest templates.. How is that done and what library are they using?
Example: http://centum.envato.tabvn.com/demo.php
Slides in from the left side.
I use drupal so I'm hoping there is a module but I couldn't find anything like it.
Any ideas?
WHY AM I GETTINGS VOTED DOWN? PLEASE EXPLAIN IF I'VE DONE SOMETHING WRONG HERE
This is fairly easy to create yourself just by adding classes with an onClick handler, and then styling with the classes how you see fit. They're probably not using a plugin for this but is actually a bespoke function they've created them selves with the jQuery library.
For example.
$('.style').on('click',function(){
$('.itemToChange').addClass('styleOne');
});
Please see a basic example with this Fiddle.
Please note this is a VERY basic version, and the example you show is much more indepth
if someone still looking here are two solutions
Blast.js or
JTS
The example you provided is using this
http://drupal.org/project/flexslider
EDIT
I'm sorry I got confused.
The style switcher is custom made by Envato, the company behind themeforest you can find the code here
http://centum.envato.tabvn.com/sites/all/themes/centum/js/switcher.js

Simple lightbox feedback form? Included screenshot

There are so many lightboxes to choose from, I'm looking for a very lightweight one to use in an embedded javascript widget that would be a single domain name. I saw the perfect one on chainreactioncycles.com, it popped up out of nowhere so I took a screenshot:
I tried looking for info on it on the page source, but couldn't find anything that would let me trace where it came from... Would anybody know of one like this? Or exactly that one?
If not exactly like above, anything similar would be great too, keeping the following in mind:
Very small javascript download (animation not needed)
Self contained, not dependent on any libraries other than jquery (since I'm already using that anyway).
Works in major browsers
Close button (like GetSatisfaction or UserVoice)
Dims background
Avoids javascript namespace conflicts (or can easily be made to avoid them)
CSS styling of lightbox does not interfere with site styling
Have you used an existing lightbox scripts for this same purpose with similar requirements? Did you roll your own? Insights welcome!
What you are looking for is called a modal box.
Here is a list of them
... and here is a striking replica of what you are looking for
Check out Zoombox.. It sounds like what you're looking for... Simple to use... Allows custom content.. jQuery Module... From past experience it covers what you have outlined as requirements etc
http://www.grafikart.fr/zoombox will tell you all you need to know.

jQuery SO Vote-Object and Scope

This is a javascript question. The fact that it mentions this website is irrelevant. This does not belong on meta.
I'm working on a Greasemonkey script to auto-load additional pages of answers onto the first page of answers here at Stackoverflow as you scroll. This is working well. I want to maintain the ability to up-vote/down-vote the loaded items, so I'm using $.live(), which is also working fine.
My problem is that the vote-object, used by SO, is not found within the scope of the $.live() method, or atleast I think that is the problem.
$(".vote-up").live("click", function(D){
vote.up($(D.target));
});
$.get("/questions/1151074", function(data){
$("div.answer", data).insertAfter(".answer:last");
});
That's bit of sample code you can paste into your firebug console to test. You can see that vote, in the context of the .live() call is not accessible. How can I fix this?
Try unsafeWindow.vote.up().
See the docs. It's a security measure of sorts. Annoying when you forget though.

What are some good pop-up dialog boxes for Ruby on Rails

I want to use modal pop-up windows in our web app in Ruby on Rails. Note that I don't want to create a new browser window, but a sub-window inside the existing webpage. We've tried things like TinyBox, but there are issues with returning error information from inside the controller. Any good method or tool that works well in ruby?
There's also prototype-window.
I've never used it myself (not yet at least) but have you tried RedBox?
I'm investigating ModalBox at the moment and it's looking promising.
There's a Google Group and Rails plugin which replaces the basic confirm popup with a modal dialog box.
Try TopUp! It is developed in a Rails application and you can get it from GitHub.
Please note that it is still beta. Feedback is always welcome ;)
Facebox, jquery, that Github use is the best one. There is also a prototype version.
I've used Lightbox Gone Wild for a while now, though I've modified it to display a DIV or other element that's already on the page (though hidden) and then return it to it's parent when the box is closed. I've used it make make Wizards that guide the user through a process.
I've used facebox_render for all my rails projects. It's really easy to use and provided complete helper. You can easily render html or javascript in your RESTful controller.
I have tried several of the ones mentioned above but after twiking it a bit I found that http://www.methods.co.nz/popup/popup.html works better for me, the only problem is that you have create an error routing similar to the one Rails uses, when returning to the popup window with errors the pop up window does not have a way to handle it

Categories