Questions tagged [sammy.js]

Sammy is a tiny javascript framework built on top of jQuery, It's RESTful Evented Javascript.

Sammy.js is a tiny JavaScript framework developed to ease the pain and provide a basic structure for developing JavaScript applications. Sammy tries to achieve this by providing a small ‘core’ framework and an ever-growing list of plugins for specific functionality.

The core includes a simple API for defining applications which are made up primarily of routes and events. By driving application development around a small and specific API, Sammy attempts to keep your code organized while still allowing a lot of breathing room to define your own style and structure.

253 questions
25
votes
3 answers

Command-click doesn't open a new tab, but middle-click does

On my website, which is a one-page JS site using Sammy.js and jQuery, when I middle-click a link with a mouse, the link opens in a new tab. But when I command-click on a Mac, it doesn't. This happens in both Firefox and Chrome, so I assume it must…
Paul Biggar
  • 27,579
  • 21
  • 99
  • 152
18
votes
1 answer

Weird redirect using data-bind submit, sammy.js and knockout.js together

I have a form like this on my page:
If I have this code in my JS script (of course I've removed all of the unrelated code and tested to make sure I can still recreate with only this code, normally you'll…
eselk
  • 6,764
  • 7
  • 60
  • 93
14
votes
3 answers

Understanding the VS2013 MVC 5 SPA template

I've started playing with the Single Page Application template for MVC 5 that comes with Visual Studio 2013. I'm more than familiar with Knockout.js, and although I wasn't with Sammy.js I've been reading up on it and it doesn't seem all that…
12
votes
2 answers

Change hash without triggering Sammy event

function UsersVM(start_page){ var self = this; console.log('start form ' + start_page); self.go_to = function(page) { location.hash = '#Users/' + pageNumber; } } Sammy(function() { this.get('/app/?#Users/:page', function () { …
Andrew Luzkovky
  • 251
  • 3
  • 10
11
votes
1 answer

Sammy.js cache and scroll position when going back in history

I don't know if anyone is still using Sammy.js, but I found it perfectly suits my needs for a lightweight routing and templating library. If anyone has other ideas, please let me know. My problem is that when I have a long page and I scroll down,…
Lasse Bunk
  • 1,848
  • 20
  • 21
9
votes
5 answers

Mobile Safari: why is window.scrollTo(0, 0) not scrolling to (0, 0)?

I've built a small single-page web app using Bootstrap 3, Sammy.js and Knockout 3. I'm finding that when the page is scrolled down, I'm unable to get window.scrollTo(0, 0) to work on Mobile Safari when I also change location.hash - specifically on…
Rob
  • 25,984
  • 32
  • 109
  • 155
9
votes
1 answer

Sammy.js routes not firing from Knockout-bound links in IE10

I have a single page application that uses Knockout.js for data binding and Sammy.js for routing client-side (hash-based) URLs. I'm seeing a weird problem in Internet Explorer, however: sometimes links, when clicked, will change the URL in the…
9
votes
4 answers

Cancel route using Sammy.js without affecting history

I want to intercept all route changes with Sammy to first check if there is a pending action. I have done this using the sammy.before API and I return false to cancel the route. This keeps the user on the 'page' but it still changes the hash in the…
John Papa
  • 21,880
  • 4
  • 61
  • 60
8
votes
2 answers

Sammy.js 404 on root path

I'm trying to define some routes with sammy.js here is my code: $.sammy("#main_content", function() { this.get("#!/about", function() { // Code }); this.get("#!/", function() { // Code }); }).run(); If I…
Ryan
  • 4,354
  • 2
  • 42
  • 78
8
votes
2 answers

Catch-all or error routes in Sammy.js

Is it possible to define a catch-all route or an error route in Sammy.js? I know I can bind to 'error' but if no route matches that does not seem to be triggered. Thanks!
luisgo
  • 2,385
  • 4
  • 24
  • 30
8
votes
4 answers

Can't set focus() on a text field

This is just the weirdest thing. I've got a Sammy.js app, and I want to set focus on a text field right after the HTML loads. I've got this CoffeeScript here: this.partial('templates/my-template.jqt').then -> i = $('#item') debugger …
Phil Kulak
  • 6,960
  • 8
  • 45
  • 50
8
votes
2 answers

Durandal Multiple Master Pages

I am working on a SPA that I would like to use multiple master views. Here is my use case: I have a user that has a profile page. Within that profile page I would like to be able to display a couple of different views, ie. details, works, contact…
mcottingham
  • 1,926
  • 2
  • 18
  • 28
7
votes
2 answers

SammyJS json store demo - how to create modal product popup?

Does anyone have an example of making the product details of the SammyJS json store demo show up in a modal plugin like FancyBox? Here's the block of code from json store - what do I need to do to present it in a model…
phteven
  • 1,383
  • 2
  • 16
  • 29
7
votes
3 answers

block sammy.js from stealing 'real links'

I recently started using knockout.js and sammy.js to modernize my app. However I got stuck with some problems. I have some valid links on the page - users should actually navigate to that location, instead of imitating navigation behaviors using…
thkang
  • 11,215
  • 14
  • 67
  • 83
7
votes
1 answer

Detecting use of back/forward button inside Sammy.js application

In my current project we are using the Sammy.js framework for navigation. For a requirement I need to know whether a given route was run as a response of pressing the Back/Forward button or not. Is there a way to identify that?
Dima Kuzmich
  • 1,286
  • 11
  • 18
1
2 3
16 17