Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with # routing in Davis Js #103

Open
vasanthkumar258 opened this issue Jun 9, 2015 · 1 comment
Open

Problem with # routing in Davis Js #103

vasanthkumar258 opened this issue Jun 9, 2015 · 1 comment

Comments

@vasanthkumar258
Copy link

Everytime i refresh the page, an extra # is added in the url and the required page is not rendered.Please help me out.

@daslicht
Copy link

daslicht commented Sep 10, 2017

Thats how I use it:
http://ansolas.de

         function updateActiveCSSClass(req) {
  		$( "nav li a" ).each( function( index ) {
			var self = $(this);
			if(self.attr('href') != req.fullPath) {
				self.parent().removeClass('active');
			}else{
				$(this).parent().addClass('active');
			}
		});
	}

	var hijax = $("#hijax");
	function getContent(req) {
		updateActiveCSSClass(req);
		$.ajax({
		  url: req.path,
		  context: $("#hijax")
		}).done(function(data) {
			hijax.animate({
				opacity: 0
			}, 250, "easeInOutQuart", function() {
				hijax.html("");
	  			hijax.html(data);
				hijax.animate({
					opacity: 1,
				}, 250, "easeInOutQuart", function() {
                                });
			});
		});
	}


	var app = Davis(function () {
		
	  	this.get('/about', function (req) {
	  		getContent( req );
		});

		this.get('/contact', function (req) {
			getContent( req ); 
		});

		this.get('/', function (req) {
			getContent( req ); 
		});


	});
	app.start();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants