Skip to content

Instantly share code, notes, and snippets.

View chadsten's full-sized avatar
💭
Facepalming at my own terrible code since 2005

Chadsten chadsten

💭
Facepalming at my own terrible code since 2005
  • Colorado
View GitHub Profile
/**
* @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:
@chadsten
chadsten / gist:5711560
Created June 5, 2013 04:14
View code for the main page image, not the category header.
$view = new view();
$view->name = 'page_image';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Page Image';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
stdClass Object
(
[nid] => 72
[field_data_field_image_set_delta] => 0
[field_data_field_image_set_language] => und
[field_data_field_image_set_bundle] => case_study
[field_data_field_image_set_field_image_set_fid] => 20
[field_data_field_image_set_field_image_set_alt] =>
[field_data_field_image_set_field_image_set_title] =>
[field_data_field_image_set_field_image_set_width] => 1200
<ul class='full-images jquery-load'>
<li class='full-image fullsize-item-1 jquery-load' full='http://localhost/eco/sites/default/files/styles/thumbnail/public/images/3lock-barley-cream-wheat.jpg?itok=68SH6qVS'><img src='http://localhost/eco/sites/default/files/styles/thumbnail/public/images/3lock-barley-cream-wheat.jpg?itok=68SH6qVS' alt='' /></li>
<li class='full-image fullsize-item-2 jquery-load' full='http://localhost/eco/sites/default/files/styles/thumbnail/public/images/3LockBox_Mini_Cream_cu_7624.jpg?itok=DHzQsMPJ'></li>
<li class='full-image fullsize-item-3 jquery-load' full='http://localhost/eco/sites/default/files/styles/thumbnail/public/images/3lock-choco-chestnut-full.jpg?itok=vbGPnyRn'></li>
<li class='full-image fullsize-item-4 jquery-load' full='http://localhost/eco/sites/default/files/styles/thumbnail/public/images/2-Skull-Chairs_2.jpg?itok=DFe5CQCl'></li>
<li class='full-image fullsize-item-5 jquery-load' full='http://localhost/eco/sites/default/files/styles/thumbnail/public/images/3lock-oink-
<?php
print "<ul class='full-images jquery-load'>\n";
$n = 1;
foreach ($data->_field_data['nid']['entity']->field_image_set[und] as $img) {
$render = image_style_url('thumbnail', $img['uri']);
print "<li class='full-image fullsize-item-" . $n . " jquery-load' data-full='$render'>";
if ($n == 1) {
print "<img src='" . $render . "' alt='" . $img['alt'] . "' />";
}
print "</li>\n";
jQuery(function($) {
// settings
var $slider = $('.full-images.jquery-load'); // class or id of carousel slider
var $slide = 'li'; // could also use 'img' if you're not using a ul
var $transition_time = 8000; // 1 second
var $time_between_slides = 4000; // 4 seconds
function slides(){
return $slider.find($slide);
<?php
function eco_preprocess_node(&$variables, $hook) {
$sub_date = t('@date', array('@date' => date("l, M jS, Y", $variables['created'])));
$variables['submitted'] = "Submitted by " . $variables['name'] . " on " . $sub_date;
}
function eco_preprocess_comment(&$variables) {
$sub_date = t('@date', array('@date' => date("l, M jS, Y", $variables['created'])));
jQuery(function($) {
$(document).ready(function() {
// settings
var slider = $('.full-images.jquery-load'); // class or id of carousel slider
var slide = 'li'; // could also use 'img' if you're not using a ul
var transition_time = 1000; // 1 second
var time_between_slides = 500000; // 5 seconds
var slides = slides();
// set the first carousel item to active for styling
jQuery(function($) {
$(document).ready(function() {
$('.view-id-blog .image').hover(function() {
var h = $(this).siblings('.blog-details').height();
var t = $(this).siblings('.blog-details').children('.title').height();
$(this).siblings('.blog-details').animate({
marginTop: -h
}, 300, function() {
});
.title {
color: blue;
text-transform: uppercase;
@media all and (max-width: 480/16*1em) {
font-size: 14/16*1em;
}
@media all and (min-width: 481/16*1em) {
font-size: 16/16*1em;
}
}