cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

              // mediatorの作成
window.App = {};
App.mediator = _.extend({}, Backbone.Events);

// ViewAの定義
var ViewA = Backbone.View.extend({
  events: {
    'click #buttonA': 'clickA' // 1.クリックイベントを取得
  render: function() {
    this.$el.append($('<button></button>', {
      text: 'click me!!',
      id: 'buttonA'
    return this;
  clickA: function() {
    // 2.イベントが発生したことをmediatorに伝える

// ViewBの定義
var ViewB = Backbone.View.extend({
  initialize: function() {
    // 3.mediatorを購読している、Viewのイベントが発火
    this.listenTo(App.mediator, 'clickA', this.clickA);
  render: function() {
    this.$el.append($('<b></b>', {
      text: 'view B!!',
      id: 'target'
    return this;
  // 4.実行される関数
  clickA: function(){

// 描画
var viewA = new ViewA();
var viewB = new ViewB();
Loading ..................