- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2016 01:18 AM
Hello,
Consider I have a list of questions. When I click on the first question, it should automatically take me to the bottom of the page.
window.scrollTo(0,document.body.scrollHeight); won't work as document won't work in API.
Thanks
Saranya
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2016 08:39 PM
Hello Mansoor,
I got the solution for the same.
$scope.scrollTo = function(id) {
var old = $location.hash();
$location.hash(id);
$anchorScroll();
//reset to old to keep any additional routing logic from kicking in
$location.hash(old);
};
<sp-model form-model="::data.sc_cat_item" mandatory="mandatory" ng-click="scrollTo('e30904d54f83e200bb603f828110c721')" ></sp-model>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2016 01:28 AM
Hi Saranya,
Try this.
<button onclick="scrollWin(0, -50)">Scroll up</button>
<script>
function scrollWin(x, y) {
window.scrollBy(x, y);
}
</script>
Regards,
Vikas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2016 01:36 AM
Hello Malhotra,
Where I need to add this?
I need to scroll botton of the page while answering the question. Didn't need any button for it.
Thanks
Saranya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2016 02:48 AM
Hi Saranya,
Try this link AngularJS - anchorscroll.
Where you can scroll to the element which have the id mentioned in the script.
$scope.gotoBottom = function() {
// set the location.hash to the id of
// the element you wish to scroll to.
$location.hash('bottom');//bottom is an element id
// call $anchorScroll()
$anchorScroll();
};
-Mansoor
-Mark correct or helpful as applicable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2016 02:53 AM
Hello Mansoor,
Thank you for the reply.
Sorry for the silly question.
Where I need to use it?
Is it in catalog widget or on change of my question variable?