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
// instantiate the addressPicker suggestion engine (based on bloodhound) | |
var addressPicker = new AddressPicker({map: {id: '#map'}}); | |
// instantiate the typeahead UI | |
$('#address').typeahead(null, { | |
displayKey: 'description', | |
source: addressPicker.ttAdapter() | |
}); | |
// Bind some event to update map on autocomplete selection |
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
git clone git://github.com/sstephenson/rbenv.git .rbenv | |
git clone git://github.com/sstephenson/ruby-build.git | |
echo 'export PATH="$HOME/.rbenv/bin:$HOME/ruby-build/bin:$PATH"' >> ~/.bash_profile | |
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile | |
. .bash_profile | |
rbenv install 2.1.2 | |
rbenv global 2.1.2 |
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
// Click on labels | |
$('productbrowser').on("mousedown", ".label", function(event, element) { | |
var steps = {'pb-cat1': 0, 'pb-cat2': 6, 'pb-cat3': 13, 'pb-cat4': 24}; | |
carousel.goTo(steps[element.id]); | |
event.stop(); | |
}); |
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
// Smallest code to make a slider behavior by dragging the slider's handle | |
function sliderMousedown(event) { | |
event.stop(); | |
mouseX = event.pointerX(), left = parseFloat(slider.style.marginLeft || 0); | |
// Observe mousemove and mouseup on document for dragging behavior | |
document.observe('mousemove', sliderMousemove).observe('mouseup', sliderMouseup); | |
} | |
function sliderMousemove(event) { |
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
// Create a carousel in one-line code | |
var carousel = new S2.UI.Carousel("productbrowser", {slider: 'slider'}); |
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
// Click on track or labels | |
track.observe("mousedown", function(event) { | |
var element = event.findElement(), | |
steps = {'pb-cat1': 0, 'pb-cat2': 6, 'pb-cat3': 13, 'pb-cat4': 24}, | |
localMouseX = event.pointerX() - track.viewportOffset().left, | |
pos = (localMouseX - slider.getWidth() / 2) / width * carousel.maxPos; | |
if (element.id in steps) { | |
carousel.goTo(steps[element.id] || pos); | |
} | |
else { |
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
<div id="hcarousel" class="ui-carousel-horizontal"> | |
<div id="hpaginate" class="ui-carousel-paginate"> | |
<div class="ui-icon ui-icon-circle-arrow-w ui-carousel-prev"></div> | |
<ul></ul> | |
<div class="ui-icon ui-icon-circle-arrow-e ui-carousel-next"></div> | |
</div> | |
<div class="ui-carousel-container"> | |
<ul> | |
<li class="item"> | |
... |
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
<div id="hcarousel" class="ui-carousel-horizontal"> | |
<div class="ui-carousel-container"> | |
<ul> | |
<li class="item1">1</li> | |
<li class="item2">2</li> | |
... | |
</ul> | |
</div> | |
<div id="hpaginate" class="ui-carousel-paginate"> | |
<div class="ui-icon ui-icon-circle-arrow-w ui-carousel-prev"><a href="#" onclick="return false"><</a></div> |
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
new S2.UI.Carousel("hcarousel", {paginator: 'hpaginate', cycle: "loop"}); |
OlderNewer