第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

對(duì)從數(shù)據(jù)庫(kù)中檢索到的數(shù)據(jù)進(jìn)行分頁(yè)后,模式窗口不會(huì)打開(kāi)

對(duì)從數(shù)據(jù)庫(kù)中檢索到的數(shù)據(jù)進(jìn)行分頁(yè)后,模式窗口不會(huì)打開(kāi)

我使用 Bootstrap 框架、php、SQL 和 jQuery 構(gòu)建了一個(gè)圖片庫(kù),用戶(hù)可以在其中單擊縮略圖以在模式窗口內(nèi)查看他們選擇的圖片放大。所有圖像都存儲(chǔ)在數(shù)據(jù)庫(kù)中。代碼按預(yù)期工作,直到我對(duì)畫(huà)廊進(jìn)行分頁(yè)。現(xiàn)在,當(dāng)單擊縮略圖時(shí),模式窗口不會(huì)打開(kāi)。任何人都可以建議解決此問(wèn)題嗎?我自己嘗試了一些解決方案,但到目前為止都沒(méi)有奏效。非常感謝。畫(huà)廊.php 代碼:<div class='row' id='pagination_data'>    <!--Fetch and display images from database -->              <?php ?></div>   <!--Bootstrap modal window --><div class="modal fade" id="imagemodal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog modal-xl"><div class="modal-content">                <div class="modal-body">    <button type="button" class="close" data-dismiss="modal"><span aria-  hidden="true">&times;</span><span class="sr-only">Close</span></button>    <img src="" class="imagepreview" style="width: 100%;" >  </div></div></div></div><script>//PAGINATION SCRIPT $(document).ready(function(){    //when fucntion is called fetch data from gallery table    load_data();    function load_data(page) {         $.ajax({            url:"pagination.php",            method: "POST",            data:{page:page},            success:function(data){                $('#pagination_data').html(data);            }        })    }    $(document).on('click', '.pagination_link', function()  {        var page = $(this).attr("id");        load_data(page);    });});</script><script>//MODAL SCRIPT$(function() {    $('.pop').on('click', function() {        $('.imagepreview').attr('src', $(this).find('img').attr('src'));        $('#imagemodal').modal('show');       });     });</script>pagination.php 代碼:$record_per_page = 18;$page = ''; //store current page number$output = '';//check if page variable is present if (isset($_POST["page"]))  {//ajax function$page = $_POST["page"];} else {$page = 1;}jQuery 版本:https ://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
查看完整描述

1 回答

?
智慧大石

TA貢獻(xiàn)1946條經(jīng)驗(yàn) 獲得超3個(gè)贊

$('.pop').on('click', function() {僅將處理程序附加到當(dāng)前在 DOM 中的元素。由于您在檢索圖像之前調(diào)用它,因此它什么也不做。

您需要使用委托的事件處理程序。

 $(document).on('click', '.pop', function() {


查看完整回答
反對(duì) 回復(fù) 2022-10-14
  • 1 回答
  • 0 關(guān)注
  • 90 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)