<core-scaffold responsiveWidth="600px"> <core-header-panel navigation flex mode="scroll"> <core-toolbar>Navigation</core-toolbar> <core-menu theme="core-light-theme"> <core-item icon="home" label="Home"></core-item> <core-item icon="assignment-ind" label="Who am i"></core-item> <core-item icon="work" label="Works"></core-item> <core-item icon="work" label="Skills"><a class="nav" href="#skill"></a></core-item> <!-- WHEN CLICK WILL GO TO SKILL ID DIV --> <core-item icon="settings-phone" label="Contacts"></core-item> <core-item icon="link" label="v8"></core-item> <core-item icon="link" label="v7"></core-item> <core-item icon="link" label="v6"></core-item> </core-menu> </core-header-panel><div id="skills"> <!-- should scroll on this part --> <skills-koh></skills-koh> <!-- my element --></div>
</core-scaffold>jQuery(".nav").on("click", function(event){ event.preventDefault(); var dest=null; if(($($(this.hash)).offset().top) > ($(document).height()-$(window).height())){ dest= $(document).height()-$(window).height(); }else{ dest=$($(this.hash)).offset().top; } $($(this.hash)).trigger("click"); $('html,body').animate({scrollTop:dest}, 500, 'swing' ); });<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/158ccc8e-3707-4624-9ec6-a62267f8ead6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
scrollToTopic: function(e) { var id = e.target.getAttribute('name'); if (id) { this.$.core_scroll_header_panel.scroller.scrollTop = this.$[id].offsetTop - 75; } }
<core-item icon="gesture" label="Skills" name="skills" on-tap="{{scrollToTop}}"><a href="#skill"></a></core-item>
<script> Polymer({ ready: function() { scrollToTopic: function(e) { var id = e.target.getAttribute('name'); if (id) { this.$.core_scroll_header_panel.scroller.scrollTop = this.$[id].offsetTop - 75; } } } }); </script><!DOCTYPE html><head><title>Test Site</title><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="chrome=1" /><meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="stylesheet" href="css/style.css"><script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script><script src="js/viewportchecker.js?v=20120206"></script><script src="js/jigsv9.js?v=1.9"></script><script src="components/platform/platform.js"></script> <link rel="stylesheet" type="text/css" href="css/animate.css" /> <link rel="import" href="components/polymer/polymer.html"> <link rel="import" href="components/core-scaffold/core-scaffold.html"> <link rel="import" href="components/core-header-panel/core-header-panel.html"> <link rel="import" href="components/core-item/core-item.html"> <link rel="import" href="components/core-menu/core-menu.html"> <link rel="import" href="components/core-toolbar/core-toolbar.html"> <link rel="import" href="components/core-icon/core-icon.html"> <link rel="import" href="elements/header-koh.html"> <link rel="import" href="elements/toolbar-koh.html"> <link rel="import" href="elements/about-koh.html"> <link rel="import" href="elements/works-koh.html"> <link rel="import" href="elements/skills-koh.html"> <link rel="import" href="elements/contacts-koh.html"> <link rel="import" href="components/paper-icon-button/paper-icon-button.html"> <link rel="import" href="components/paper-fab/paper-fab.html"> <link rel="import" href="components/font-roboto/roboto.html"> <link rel="stylesheet" href="foundation/css/foundation.css" /> <script src="foundation/js/vendor/modernizr.js"></script> <link href="css/hover-min.css" rel="stylesheet" media="all"> <!-- load icons --> <link rel="import" href="components/core-icons/av-icons.html"> <link rel="import" href="components/core-icons/communication-icons.html"> <link rel="import" href="components/core-icons/device-icons.html"> <link rel="import" href="components/core-icons/editor-icons.html"> <link rel="import" href="components/core-icons/hardware-icons.html"> <link rel="import" href="components/core-icons/image-icons.html"> <link rel="import" href="components/core-icons/maps-icons.html"> <link rel="import" href="components/core-icons/notification-icons.html"> <link rel="import" href="components/core-icons/social-icons.html">
</head><body unresolved><toolbar-koh></toolbar-koh><a href="http://google.com" target="_blank"><paper-fab icon="assignment-ind" class="cv"></paper-fab></a><core-scaffold responsiveWidth="600px"> <core-header-panel navigation flex mode="scroll"> <core-toolbar>Navigation</core-toolbar> <core-menu theme="core-light-theme"> <core-item icon="home" label="Home"></core-item> <core-item icon="account-circle" label="Who am i"></core-item> <core-item icon="work" label="Works"></core-item> <core-item icon="gesture" label="Skills" name="skills" on-tap="{{scrollToTop}}"><a href="#skill"></a></core-item> <core-item icon="settings-phone" label="Contacts"></core-item> <core-item icon="link" label="v8"></core-item> <core-item icon="link" label="v7"></core-item> <core-item icon="link" label="v6"></core-item> </core-menu> </core-header-panel> <div tool><strong>Test</strong> <span style="font-weight:300;">Site</span></div>
<div><header-koh></header-koh></div>
<div class="ab-effect"> <div id="about"> <about-koh></about-koh> </div></div><div class="wk-effect"> <div id="works"> <works-koh></works-koh> </div></div><div class="sk-effect"> <div id="skills"> <skills-koh></skills-koh> </div></div><div class="ct-effect"> <div id="contacts"> <contacts-koh></contacts-koh> </div></div>
</core-scaffold>
<script src="foundation/js/vendor/jquery.js"></script> <script src="foundation/js/foundation.min.js"></script> <script> $(document).foundation(); </script> <script> Polymer({ ready: function() { scrollToTopic: function(e) { var id = e.target.getAttribute('name'); if (id) { this.$.core_scroll_header_panel.scroller.scrollTop = this.$[id].offsetTop - 75; } } } }); </script>
</body></html>
and here's my full index.html
<head><title>Test Site</title><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="chrome=1" /><meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="stylesheet" href="css/style.css"><script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script><script src="js/viewportchecker.js?v=20120206"></script><core-scaffold responsiveWidth="600px"> <core-header-panel navigation flex mode="scroll"> <core-toolbar>Navigation</core-toolbar> <core-menu theme="core-light-theme"> <core-item icon="home" label="Home"></core-item> <core-item icon="account-circle" label="Who am i"></core-item> <core-item icon="work" label="Works"></core-item> <core-item icon="gesture" label="Skills" name="skills" on-tap="{{scrollToTopic}}"><a href="#skill"></a></core-item> <core-item icon="settings-phone" label="Contacts" name="contacts" on-tap="{{scrollToTopic}}"><a href="#contacts"></a></core-item> <core-item icon="link" label="v8"></core-item> <core-item icon="link" label="v7"></core-item> <core-item icon="link" label="v6"></core-item> </core-menu> </core-header-panel> <div tool><strong>Test</strong> <span style="font-weight:300;">Site</span></div> <div><header-koh></header-koh></div><div class="ab-effect"> <div id="about"><about-koh></about-koh></div></div><div class="wk-effect"> <div id="works" touch-action="pan-y"> <works-koh></works-koh> </div></div><div class="sk-effect"> <div id="skills"> <skills-koh></skills-koh> </div></div><div class="ct-effect"> <div id="contacts"> <contacts-koh></contacts-koh> </div></div>
</core-scaffold>
<script src="foundation/js/vendor/jquery.js"></script> <script src="foundation/js/foundation.min.js"></script> <script> $(document).foundation(); </script> <script> Polymer({ scrollToTopic: function(e) { var id = e.target.getAttribute('name'); if (id) { this.$.core_scaffold.scroller.scrollTop = this.$[id].offsetTop - 75; } } }); </script>
</body></html>
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/f8323ede-d4f6-43cd-8ccc-17569390e2b0%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/cf9433e4-7568-4b34-b010-08d1f46e0014%40googlegroups.com.
<script> var scraffold = document.getElementById('scaffold'); var menu = document.getElementById('menu'); menu.addEventListener('core-select', function(e) { if (e.detail.isSelected) { scrollToSection(e.detail.item.getAttribute('name')); } }); function scrollToSection(id) { var section = document.getElementById(id); if (section) { scaffold.$.headerPanel.scroller.scrollTop = section.offsetTop; } } </script>