Skip to content

Instantly share code, notes, and snippets.

View AlexMold's full-sized avatar
🎯
Focusing

Alex Gribcov AlexMold

🎯
Focusing
View GitHub Profile
@AlexMold
AlexMold / server.js
Last active April 24, 2017 19:33
react-ssr-server
// React modules
import { RouterContext, match } from 'react-router'
import { renderToString, renderToStaticMarkup } from 'react-dom/server'
import React from 'react'
import NotFound from './frontend/containers/NotFound'
import routes from './routes'
import Html from './frontend/containers/Html'
class DropdownCabinet {
constructor(){
this.$toggler = $('.js-dropdown-toggler');
this.$list = $('.js-dropdown-list');
this.$html = $('html');
this.init();
}
init(){
$(function() {
$('#js-news-tabs').each(function(){
// For each set of tabs, we want to keep track of
// which tab is active and its associated content
var $active, $content, $links = $(this).find('a');
// If the location.hash matches one of the links, use that as the active tab.
// If no match is found, use the first link as the initial active tab.
$active = $($links.filter('[href="'+location.hash+'"]')[0] || $links[0]);
$active.addClass('is-active');