What errors are you seeing in your browser console?
-Jim
On Wednesday, April 1, 2020 at 4:56:07 PM UTC-5, Maurice Waka wrote:
>
> Any help on this?
> I can't get the code to work with jQuery
>
> {{extend 'layout.html'}}
>
>
> <!DOCTYPE html>
>
>
> <html><head><meta http-equiv="Content-Type" content="text/html;
> charset=UTF-8">
>
>
> <meta name="viewport" content="width=device-width, initial-scale=1">
>
>
> <script src="{{=URL('static','js/jquery-1.10.1.js')}}"></script>
>
>
> <style id="compiled-css" type="text/css">
> /*QuickReset*/
> *{margin:0;box-sizing:border-box;} html,body{height:100%;font:14px/1.4
> sans-serif;}
>
>
> article {
> height: 150vh;
> }
> </style>
>
>
>
>
> <body style="">
> <article style="background:#0bf;" id="top">WELCOME (wait 3 sec)</
> article>
> <article style="background:#f0b;" id="about">ABOUT</article>
> <article style="background:#b0f;" id="work">OUR WORK</article>
> <article style="background:#0fb;" id="testimonials">TESTIMONIALS<br>Going
> to #contact in 3sec!</article>
> <article style="background:#fb0;" id="contact">
> CONTACT <a href="#top">TO TOP</a>
> </article>
>
>
> <script type="text/javascript" src=
> "{{=URL('static','js/jquery-1.10.1.js')}}">
>
>
>
>
>
>
> function goTo(selector, timeout, cb) {
> var $el = $(selector);
> if (!$el[0]) return;
> var $par = $el.parent();
> if ($par.is("body")) $par = $("html, body");
> setTimeout(() => {
> $par.stop().animate({scrollTop: $el.offset().top}, 500, cb && cb.call($el
> [0]));
> }, timeout || 0);
> }
>
>
> // USE LIKE:
> goTo("#testimonials", 3000, function() {
> // You can use `this` to reference #testimonials! yey
> $(this).append("<br>Going to #contact in 3sec!");
> goTo("#contact", 3500);
> });
> // Alternatively, without using callbacks you can do
> // goTo("#testimonials", 3000);
> // goTo("#contact", 6000);
> // Reuse function for elements click!
> $("[href^='#']").on("click", function(e) {
> e.preventDefault();
> goTo($(this).attr("href"));
> });
>
>
>
>
>
>
> </script>
>
>
> </body></html>
>
>
> On Wednesday, April 1, 2020 at 4:14:24 AM UTC+3, Maurice Waka wrote:
>>
>> I have this code below that works well on the demo site:
>> http://jsfiddle.net/Lhg914dc/
>>
>>
>> {{extend 'layout.html'}}
>> <html>
>> <head>
>> <script src="//
>> ajax.googleapis.com/ajax/libs/jqueryui/3.4.1/jquery-ui.min.js"></script>
>> <link rel="stylesheet" href="//
>> ajax.googleapis.com/ajax/libs/jqueryui/3.4.1/themes/base/jquery-ui.css"
>> type="text/css">
>> <style>
>> /*QuickReset*/
>> *{margin:0;box-sizing:border-box;} html,body{height:100%;font:14px/1.4
>> sans-serif;}
>>
>>
>> article {
>> height: 150vh;
>> }
>> </style>
>> </head>
>> <!--button onclick="goTo(selector, timeout, cb)">Click me</button-->
>> <body>
>> <article style="background:#0bf;" id="top">WELCOME (waits 3 sec)</
>> article>
>> <article style="background:#f0b;" id="about">{{=me}}</article>
>> <article style="background:#b0f;" id="work">{{=work}}</article>
>> <article style="background:#0fb;" id="testimonials">{{=love}}</article>
>> <article style="background:#fb0;" id="contact">
>> CONTACT <a href="#top">TO TOP</a>
>> </article>
>>
>>
>>
>> <script type="text/javascript" src="https://code.jquery-3.4.1.min.js">
>>
>>
>> function goTo(selector, timeout, cb) {
>> var $el = $(selector);
>> if (!$el[0]) return;
>> var $par = $el.parent();
>> if ($par.is("body")) $par = $("html, body");
>> setTimeout(() => {
>> $par.stop().animate({scrollTop: $el.offset().top}, 1000, cb && cb.call(
>> $el[0]));
>> }, timeout || 0);
>> }
>>
>>
>> // USE LIKE:
>> goTo("#testimonials", 3000, function() {
>> // You can use `this` to reference #testimonials! yey
>> $(this).append("<br>Going to #contact in 3sec!");
>> goTo("#contact", 3000);
>> });
>> // Alternatively, without using callbacks you can do
>> //goTo("#testimonials", 3000);
>>
>>
>> //goTo("#contact", 6000);
>> // Reuse function for elements click!
>> $("[href^='#']").on("click", function(e) {
>> e.preventDefault();
>> goTo($(this).attr("href"));
>> });
>> </script>
>> </body>
>> </html>
>>
>>
>> When I try it on web2py I don't see any js/jQuery effects.
>>
>> I want to see the page scroll in stages down to specific DIVs, how can I
>> do this? where could the error be?
>>
>> Kind regards
>>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/7972be54-f400-42f0-83a7-46b7b8fee63f%40googlegroups.com.