I
I
ingrey2015-10-22 05:04:40
JavaScript
ingrey, 2015-10-22 05:04:40

jquery.smoothState.js - how to add class for body?

Hello!

There is a wonderful plugin [ https://github.com/miguel-perez/smoothState.js ] that kills two birds with one stone: ajax content loading plus css3 animation of this process. When using it, one unpleasant problem arose - it is impossible to add / update / load the class of bodythe requested page.

Example: some content from page body.homepagec is loaded into the #main block on page c body.singleThe loading is successful, animations are displayed, only the body retains the same .homepage class , but .single is needed page, and after the download is complete, update the current one ... but I don’t know how to do it.

I would be extremely happy to help, because I myself will be looking for a solution for a long time, because. not strong in js/jquery.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2015-10-22
@xa3apg

$('body').switchClass( "homepage", "single");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question