// jQuery
$(document).ready(function() {
// code
})
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
(function ($) { | |
// insert Drupal.behaviors here | |
})(jQuery); |
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
var testVar = $("body.section div.something"); | |
if (testVar.length) { // checks to if exists | |
// add code in here | |
console.log(testVar); | |
} |
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
// currently written as | |
.region-right-sidebar .block { | |
background: { | |
image: url('../../rotary_org/images/div.png'); | |
position: left top; | |
repeat: no-repeat; | |
} | |
} | |
// shorthand |
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
.common-css { | |
// these are needed regardless of browser size | |
background: blue; | |
border: 1px solid black; | |
width: 100%; | |
// adjustments based on media query | |
@media #{$large} { | |
width: 50%; |
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
(function ($, Drupal, window, document, undefined) { | |
/** | |
* Functionality for Nav bar | |
*/ | |
Drupal.behaviors.NavigationBar = { | |
attach: function (context, settings) { | |
if (context === document) { // only fires on document load | |
// JS code goes in here |
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
var timerEl; | |
$(window).bind("resize", function () { | |
if (timerEl) { | |
clearTimeout(timerEl); | |
} | |
timerEl = setTimeout(function () { | |
// put code here //////// | |
console.log('the page has been resized'); |
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
function example_preprocess_panels_pane(&$vars) { | |
// add class per pane type | |
switch ($vars['pane']->subtype) { | |
case 'something-panel_pane_plan': | |
$vars['classes_array'][] = 'gw-grid-1'; | |
break; | |
case 'another-panel_pane_plan': | |
$vars['classes_array'][] = 'gw-grid-2'; | |
break; |
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
// normal selector | |
$('.testelement .something').click(function(e) { | |
console.log('this is clicked'); | |
}); | |
// could be improved by storing as a variable | |
var something = $('.testelement .something'); | |
something.click(function(e) { | |
console.log('this is clicked'); | |
}); |
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
// previous used... | |
font-family: "Nanum Gothic", Gulim, Dotum, Arial Unicode MS, serif; | |
// now used as a variable font stack | |
$nanum-font: "Nanum Gothic", Gulim, Dotum, Arial Unicode MS, serif; | |
.something { font-family: $nanum-font; } |
OlderNewer