weixin_33744854 2013-01-22 11:56 采纳率: 0%
浏览 14

在同一页面中加载内容ajax [关闭]

                <div class="grid--cell fl1 lh-lg">
                    <div class="grid--cell fl1 lh-lg">
                        It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and   cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened,   <a href="/help/reopen-questions">visit the help center</a>.

                    </div>
                </div>
            </div>
            <div class="grid--cell mb0 mt8">Closed <span title="2013-01-22 15:42:06Z" class="relativetime">7 years ago</span>.</div>
        </div>
    </aside>

I have one page site structure. This is my menu:

I have a menu structure:

 <ul id="creamenu" class="menuHolder">
                        <li><a id="news-1-menu" href="#/creative-events">news 1</a></li>
                        <li><a id="news-2-menu" href="#/creative-ajans">news 2</a></li>
                        <li><a id="news-3-menu" href="#/incentive-travel">news 3</a></li>
                    </ul>
                    <ul id="mainmenu" class="menuHolder">
                        <li><a id="about1-menu" href="#/hakkimizda">about 1</a></li>
                        <li><a id="about2-menu" href="#/haberler">about 2</a></li>
                        <li><a id="about3-menu" href="#/galeri">about 3</a></li>
                        <li><a id="about4-menu" href="#/referanslar">about 4</a></li>
                        <li><a id="about5-menu" href="#/iletisim">about 5</a></li>
    </ul>

And this is content structure:

<div id='news-1'>
    <!-- content -->
    <!-- content -->

<div id='news-2'>
    <!-- content -->
    <!-- content -->

When i click a menu item, go to page via Parallax effect (I'm using premium plugin for this) But my site is slowly... Because, i want when i click a menu item, load content via ajax. Is it possible? How can i do it?

</div>
  • 写回答

4条回答 默认 最新

  • 笑故挽风 2013-01-22 11:58
    关注

    if the content is in other file, then you can do with $.load(url).

    $('#news-1').load('url of the content to load');
    

    if you storing the content in same page, then you can make it visible when menu clicked.

    $('#news-1').on('click',function(){
    $('#news-1').appendTo($('#creative-events').html()); // this is the prototype, need to make a generic code
    })
    
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab实现基于主成分变换的图像融合。
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊