Skip to content

Instantly share code, notes, and snippets.

@keeprock
keeprock / script.js
Created March 18, 2015 11:12
Set different timeout duration for multiple Caroufredsel sliders
auto: {
play: true,
onAfter: function (data) {
$(this).triggerHandler('configuration').auto.timeoutDuration = Math.floor(Math.random()*(max-min+1)+min);
}
}
@keeprock
keeprock / page.tpl.php
Created March 17, 2015 09:16
Display floated tab with controls
<?php if ($tabs): ?>
<div class="tabs">
<?php print render($tabs); ?>
</div>
<?php endif; ?>
@keeprock
keeprock / index.html
Last active August 29, 2015 14:17
Google Map falling pointers Code need to be checked http://moscow-krd.ru/
<li class="something" onclick="initialize_ban()"><span>Банки</span></li>
@keeprock
keeprock / script.js
Created March 16, 2015 13:55
Scroll viewport to calculated offset of a specified element
var body = $("html, body");
var element = $('SOME_SELECTOR');
body.animate({
scrollTop:element.offset().top
}, 'swing', 2000);
});
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
@keeprock
keeprock / custom.module.php
Last active August 29, 2015 14:16
Create a new style for a modal Ctools window. Allows to customize a size of the window.
function custom_init() {
//Customize modal window
drupal_add_js(array(
'CUSTOM_MODAL' => array(
'modalSize' => array(
'type' => 'fixed',
'width' => 850,
'height' => 550,
),
//Animation mode
#selector {
max-height: 0;
transition: max-height 0.15s ease-out;
overflow: hidden;
}
#selector.active {
max-height: 500px;
transition: max-height 0.25s ease-in;
}
@keeprock
keeprock / custom.module.php
Last active August 29, 2015 14:16
Loading a form using Ctools AJAX API
function custom_menu() {
$items['custom_module/some_title_describing_action/%ctools_js'] = array(
'title' => 'Subscribe',
'page callback' => 'custom_form__callback',
'page arguments' => array(2), // index starts with zero
'type' => MENU_CALLBACK,
'access callback' => TRUE
);
return $items;
@keeprock
keeprock / style.css
Created March 10, 2015 13:53
Center absolute positioned div
#content{
position:absolute;
left:0;
right:0;
margin-left:auto;
margin-right:auto;
}
@keeprock
keeprock / index.html
Created March 10, 2015 07:39
Justify text with UL and LI elements using "text-align: justify" property http://www.barrelny.com/blog/text-align-justify-and-rwd/
<ul id="Grid">
<li></li>
<li></li>
<li></li>
<li></li>
</ul>