-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
24 additions
and
37 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,2 @@ | ||
/** | ||
* @file | ||
* A JavaScript file for the theme. | ||
* | ||
* In order for this JavaScript to be loaded on pages, see the instructions in | ||
* the README.txt next to this file. | ||
*/ | ||
|
||
// JavaScript should be made compatible with libraries other than jQuery by | ||
// wrapping it with an "anonymous closure". See: | ||
// - https://drupal.org/node/1446420 | ||
// - http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth | ||
(function (Drupal, $, window) { | ||
|
||
// To understand behaviors, see https://www.drupal.org/node/2269515 | ||
Drupal.behaviors.stanford_starter = { | ||
attach: function (context, settings) { | ||
|
||
// Execute code once the DOM is ready. $(document).ready() not required within Drupal.behaviors. | ||
|
||
$(window).load(function () { | ||
// Execute code once the window is fully loaded. | ||
}); | ||
|
||
$(window).resize(function () { | ||
// Execute code when the window is resized. | ||
}); | ||
|
||
$(window).scroll(function () { | ||
// Execute code when the window scrolls. | ||
}); | ||
|
||
} | ||
}; | ||
|
||
} (Drupal, jQuery, this)); | ||
// Theme code. | ||
import './stanford_starter.behaviors.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Behavior Example that works with Webpack. | ||
* | ||
* @see: https://www.npmjs.com/package/drupal-behaviors-loader | ||
* | ||
* Webpack wraps everything in enclosures and hides the global variables from | ||
* scripts so special handling is needed. | ||
*/ | ||
|
||
export default { | ||
|
||
// Attach Drupal Behavior. | ||
attach (context, settings) { | ||
// console.log("Attached."); | ||
}, | ||
|
||
// Detach Example. | ||
detach () { | ||
// console.log("Detached."); | ||
} | ||
} |