1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

iframe after submit scroll to top

Discussion in 'JavaScript' started by lew1s666, Mar 1, 2016.

  1. #1
    i have an iframe with code

    [iframe src="http://projects.qbf.ie/smartquotes/wp-content/themes/smartquotes/form/mortgage.php" width="100%" height="1600px" onload="window.parent.scrollTo(0,0)"]

    after submitting the form i result is in middle of the page. I tried many javascripts codes but its not working.

    here is the form website http://projects.qbf.ie/smartquotes/mortgage-life-insurance/

    can somebody help me ?
     
    lew1s666, Mar 1, 2016 IP
  2. hdewantara

    hdewantara Well-Known Member

    Messages:
    536
    Likes Received:
    47
    Best Answers:
    25
    Trophy Points:
    155
    #2
    What's wrong with adjusting this through your Smartquotes theme's quotes.js ?
     
    hdewantara, Mar 1, 2016 IP
  3. lew1s666

    lew1s666 Member

    Messages:
    101
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #3
    the iframe is in wordpress page and calling morgages.php where is quotes.js in head. what you mean add in quotes.js ?
     
    lew1s666, Mar 1, 2016 IP
  4. hdewantara

    hdewantara Well-Known Member

    Messages:
    536
    Likes Received:
    47
    Best Answers:
    25
    Trophy Points:
    155
    #4
    Right.
    I see your quotes.js in here:
    http://projects.qbf.ie/smartquotes/wp-content/themes/smartquotes/form/quotes.js

    Now as part of that quotes.js, these lines below will do something when someone submits the form, right?
    
    
    $('form').submit(function() {
    $(this).fadeOut(250).before('<div style="text-align: center; font-size: 32px;"><img src="loader2.gif" alt="loading" /><br />Loading...</div>');
    });
    Code (JavaScript):
    So if you can add some lines to it to also scroll parent window after a submission... that should be a solution to your question?

    Hendra
     
    hdewantara, Mar 1, 2016 IP
  5. lew1s666

    lew1s666 Member

    Messages:
    101
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #5
    i tried already some jquery there like:
    and nothing is working. can you help me please ? thanks

    $('form').submit(function() {
    $(this).fadeOut(250).before('<div style="text-align: center; font-size: 32px;"><img src="loader2.gif" alt="loading" /><br />Loading...</div>');

    $('#myiframe').contents().scrollTop(0);
     
    lew1s666, Mar 1, 2016 IP
  6. hdewantara

    hdewantara Well-Known Member

    Messages:
    536
    Likes Received:
    47
    Best Answers:
    25
    Trophy Points:
    155
    #6
    Try something like below,
    
    
    $('form').submit(function() {
      $(this).fadeOut(250).before('<div style="text-align: center; font-size: 32px;"><img src="loader2.gif" alt="loading" /><br />Loading...</div>');
      window.parent.scrollTo(0,0);
    });
    Code (JavaScript):
     
    hdewantara, Mar 1, 2016 IP
  7. lew1s666

    lew1s666 Member

    Messages:
    101
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #7
    thanks man. i tried this before but now its working. thanks again !
     
    lew1s666, Mar 1, 2016 IP
  8. hdewantara

    hdewantara Well-Known Member

    Messages:
    536
    Likes Received:
    47
    Best Answers:
    25
    Trophy Points:
    155
    #8
    my pleasure to help ;)
     
    hdewantara, Mar 3, 2016 IP