Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery effects not visible in php if "echo" is used for output
    primarykey
    data
    text
    <p>im having small image gallery that uses fancybox. So on each image there is a hover and popup effect. Below is my code</p> <pre><code>&lt;div class="one-third column hover"&gt; &lt;a href="large/28crowview_ld.jpg" class="image-box"&gt; &lt;div class="photo"&gt; &lt;span class="text"&gt;&lt;span class="anchor"&gt;&lt;/span&gt;&lt;/span&gt; &lt;/div&gt; &lt;img src="large/28crowview_ld.jpg" height="170px" width="260px"/&gt; &lt;/a&gt; &lt;/div&gt; </code></pre> <p>the above code works perfectly.</p> <p>but im using a ajax controller that returns the above code using an echo</p> <pre><code> echo '&lt;div class="one-third column hover"&gt; &lt;a href="large/28crowview_ld.jpg" class="image-box"&gt; &lt;div class="photo"&gt; &lt;span class="text"&gt;&lt;span class="anchor"&gt;&lt;/span&gt;&lt;/span&gt; &lt;/div&gt; &lt;img src="large/28crowview_ld.jpg" height="170px" width="260px"/&gt; &lt;/a&gt; &lt;/div&gt;'; </code></pre> <p>but when i use the echo tag the images are displayed but non of the hover effects are visible. it was very odd. and i also noticed the same issue on my social bar.</p> <p>It works perfectly when i use it in a html view. But when i echo, i see the code in the source but the icons are not visible</p> <pre><code>echo '&lt;div class="supersocialshare" data-networks="facebook,google,twitter,linkedin,pinterest" data-url="'.$share.'" data-orientation="line"&gt;&lt;/div&gt;'; </code></pre> <p>all the images are placed correctly, no js conflicts.</p> <p>Below is the java script im using</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { var track_click = 0; //track user click on "load more" button, righ now it is 0 click var total_pages = &lt;?php echo $total_pages; ?&gt;; $('#results').load("&lt;?php echo base_url() ?&gt;fetch_pages", {'page':track_click}, function() {track_click++;}); //initial data to load $(".load_more").click(function (e) { //user clicks on button $(this).hide(); //hide load more button on click $('.animation_image').show(); //show loading image if(track_click &lt;= total_pages) //make sure user clicks are still less than total pages { //post page number and load returned data into result element $.post('&lt;?php echo base_url() ?&gt;fetch_pages',{'page': track_click}, function(data) { $(".load_more").show(); //bring back load more button $("#results").append(data); //append data received from server //scroll page to button element $("html, body").animate({scrollTop: $("#load_more_button").offset().top}, 500); //hide loading image $('.animation_image').hide(); //hide loading image once data is received track_click++; //user click increment on load button }).fail(function(xhr, ajaxOptions, thrownError) { alert(thrownError); //alert any HTTP error $(".load_more").show(); //bring back load more button $('.animation_image').hide(); //hide loading image once data is received }); if(track_click &gt;= total_pages-1) { //reached end of the page yet? disable load button $(".load_more").attr("disabled", "disabled"); } } }); }); &lt;/script&gt; </code></pre> <p>inside fetch_pages</p> <pre><code> $page_number = filter_var($this-&gt;input-&gt;post('page'), FILTER_SANITIZE_NUMBER_INT, FILTER_FLAG_STRIP_HIGH); //throw HTTP error if page number is not valid if(!is_numeric($page_number)){ header('HTTP/1.1 500 Invalid page number!'); exit(); } $item_per_page = 5; //get current starting point of records $position = ($page_number * $item_per_page); $cottages = $this-&gt;properties-&gt;getstuff($sub_location,$position, $item_per_page); foreach ($props as $cots): echo'&lt;div class="container section" id="'.$cots["id"].'"&gt; &lt;div class="one-third column hover"&gt; &lt;a href="'.$cots["image_url"].'" class="image-box"&gt; &lt;div class="photo"&gt; &lt;span class="text"&gt;&lt;span class="anchor"&gt;&lt;/span&gt;&lt;/span&gt; &lt;/div&gt; &lt;img src="'.$cots["image_url"].'" height="170px" width="260px"/&gt; &lt;/a&gt; &lt;/div&gt;'; endforeach; </code></pre> <p>Im building this project using codeigniter, php and jquery. Any help will be appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload