Laravel-重定向到页面并滚动到页面底部 [英] Laravel - redirect to page and scroll to the bottom of the page

查看:90
本文介绍了Laravel-重定向到页面并滚动到页面底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Laravel框架,并且在我的控制器中有

Im using Laravel framework and in my controller I have

return Redirect::route('home'); 

正在重定向到主页.但是我想完成页面的向下滚动,以便在重定向时看到页脚.像href="home#footer"那样有办法吗?

which is redirecting to homepage. But I would like to accomplish the page to be scrolled down to see footer when redirecting. Something like href="home#footer" Is there a way for that?

推荐答案

您可以生成路线的URL,然后附加哈希并重定向到该URL

You can generate the URL for the route then append the hash and redirect to that url

$url = URL::route('home') . '#footer';
return Redirect::to($url);

这篇关于Laravel-重定向到页面并滚动到页面底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆