How JQuery working to the open page?

Как запустить скрипт jquery в окне ? Понятно что он подключён в документе , но в открывающемся окне его не видит программа .? Help meee

Using Google Translate your question comes out as:

So, which window? You mean the page? We really don’t understand your problem, please post some code that shows us the problem you’re having.

Ok Hello ! I have a working comment script, I want to use it in a project on f7 … problem: when I click on the link with the record id, a window opens in accordance with the route, but in this window I can’t get the comment script, f7 just doesn’t initializes and does not see it … how do I initialize a script?

If I understand you, when you click on a link and open a new page via the routes table your init code isn’t being run. I had this same problem when I moved over from Jquery Mobile and here’s what I did:

In app.js I added this to catch the page changes:

$(document).on('page:init', function (e, page) {
  if(page.name == null) 
    console.log("Initializing app");
  else
    console.log("page:init=" +page.name);
  // call the page engine
  pageEngine(e, page);
});

And then this pageEngine looks like this:

function pageEngine(event, page)
{
  //  page.name is taken from 'data-name="pageX"'
  switch(page.name)
  {            
    case "home":
      // this is /home/ in the route table
      break;

    case "pageA":
        $.getScript("js/pageA.js", function( data, textStatus, jqxhr ) {
            pageAReady();
        }).fail(function(xhr, textStatus, error) { jsLoadError(xhr, textStatus, error, "alerts list"); });
        break;
    
    case "pageX":
        $.getScript("js/pageX.js", function( data, textStatus, jqxhr ) {
            pageXReady();
        }).fail(function(xhr, textStatus, error) { jsLoadError(xhr, textStatus, error, "pageX"); });
        break;
  }
}

The page definition has the page name like this:

<div id="myPage" class="page" data-name="pageX">
  <div class="page-content">
    <center><h2>Page X</h2></center>
    <div class="block">
      <p>blah blah blah</p>
      <a href="/" class="button button-fill">Home <span class="fas fa-home"></span></a>
    </div> <!-- end of block -->
  </div>  <!-- end of content area -->
</div>  <!-- end of page -->

Using this, when I load a page via routes, the external “pageX.js” gets loaded and the init function gets called.

Is that what you mean?

1 Like

Why don’t you use framework7 DOM. It is capable of almost everything jQuery is. And they are very similar

In my case (as I’m sure is the case for lots of other people as well), I have too much code written in jQuery and I don’t want to rewrite it or port it or deal with potential bugs that I don’t have now.

Oh I see. I thought in that direction but I knew you would have your reasons. I was wondering if you have an idea on this…

I am building a social network and I want to go mobile first before I put out a web presence…I have a page profile.html but as users all have their specific Ids, I send these over as get variables…like so profile.html?id=1, profile.html?id=2 and then I script waiting to pick the Ids with page.query.id. All works brilliantly, except F7 only caches the last visited profile page. Please help.